回顾创建项目报错

一、创建虚拟环境

  1. 安装虚拟环境pip install virtualenv
  2. 创建虚拟环境virtualenv venv(venv就是虚拟环境名称,自定义)
  3. 进入虚拟环境venv\Scripts\activate
  4. 安装所需软件:pip install django==1.9.6
  5. 退出deactivate

二、创建项目

  1. 进入虚拟环境,执行命令python django-admin.py startproject znytest,(创建项目),若出现报错找不到django-admin.py,在venv找到复制到当前目录即可
  2. 创建应用 在znytest中执行命令 python manage.py startapp app01 若出现报错django.utils.encoding.DjangoUnicodeDecodeError: ‘utf8‘ codec can‘t decode byte 0xd5 in position 9: invalid continuation byte. You passed in ‘C:\\Users\\\xd5\xc5\xc4\xfe\xd1\xf4\\znytest\\db.sqlite3‘ (<type ‘str‘>)在settings中将数据库改为mysql即可

    DATABASES = {
        ‘default‘: {
            ‘ENGINE‘: ‘django.db.backends.mysql‘,
            ‘NAME‘: ‘test‘,
            ‘USER‘: ‘root‘,
            ‘PASSWORD‘: ‘root‘,
            ‘HOST‘: ‘127.0.0.1‘,
            ‘PORT‘: ‘3306‘,
        }
    }
    

      在settings.py同目录下的__init__.py中

    import pymysql
    pymysql.install_as_MySQLdb()
    

      windows安装mysql:http://www.cnblogs.com/zhangningyang/p/7479112.html#lod6,若出现找不到msvcr120.dll安装vcredist_x64.exe即可,https://www.microsoft.com/zh-cn/download/confirmation.aspx?id=40784

原文地址:https://www.cnblogs.com/zhangningyang/p/10025905.html

时间: 2024-08-27 01:57:42

回顾创建项目报错的相关文章

quick3.3final版创建项目报错解决

quick3.3final版创建项目报错解决 今天新下载了quick3.3final版,于是安装,创建项目,打开player新建项目如下图 然后点击创建,就发生了如下错误,相信应该有不少朋友会碰到的 首先,这里有两个错误 1.PHP Notice:  Undefined index: extracmd in /Users/wangmeng/Documents/quick-3.3/quick/bin/lib/quick/ProjectCreator.php on line 117 这是117行有未

Ionic start 创建项目报错

Installing npm packages... Error with start undefined Error Initializing app: There was an error with the spawned command: npminstall There was an error with the spawned command: npminstall Caught exception: undefined ionic 2 创建项目的时候报错如上:本人试了好多方法,npm

创建项目报错解决方法

1.安装django2.配置django的环境变量C:\Users\huojia\AppData\Local\Programs\Python\Python36-32\Lib\site-packages\django3.运行命令行创建django项目选好目录,执行django-admin startproject mysites项目名称项目就被创建了,但是报错,Couldn't import Django. Are you sure it's installed and available on

vue-cli创建项目报错&quot;ChromeDriver binary is unavailable&quot;

在使用vue init webpack -g demo时产生了一个错误,导致创建项目失败: "Current existing ChromeDriver binary is unavailable, proceding with download and extraction." 我的解决办法: 1.去官网下载当前chromedriver_win32.zip (2.46版本)的压缩包,地址http://chromedriver.storage.googleapis.com/index.

vue创建项目报错显示vue 和 vue-template版本不同

既然是版本不一致,那么只需要把vue与vue-template-compiler的版本更新为一致的就行了 第一种办法: 更新vue-template-compiler到与vue同版本 把vue-template-compiler卸载(cnpm uninstall vue-template-compiler), 再重新安装一个与vue版本一致的vue-template-compiler(cnpm install [email protected]报错中提示的vue-template-compile

创建maven项目报错

我在自己的电脑上装了一个MyEclipse6.5 和spring tools suit 3.5.1  因为sts自带了maven插件,所以只要在 preference里面配置下maven的本地路径和settings文件的本地路径就可以了, 配置完了之后 我在MyEclipse和sts里面都导入了maven项目 都可以运行,我就觉得maven配置好了,但是我在sts里面创建maven项目的时候报错 Could not calculate build plan: Plugin org.apache.

IDEA创建maven项目报错解决:Failed to create a Maven project: &#39;C:/Users/../IdeaProjects/../pom.xml&#39; already e

晚上用IDEA创建Java的maven项目时报错了: Failed to create a Maven project: 'C:/Users/../IdeaProjects/../pom.xml' already exists in VFS1这个错误是因为之前我已经在这个文件夹里创建过同名的maven项目. 解决方法如下: 先把这个项目删了,然后把回收站中的这个项目和之前同名的项目一起彻底删除,重新创建一遍就不会报错了 IDEA创建maven项目报错解决:Failed to create a M

Error:Cannot build artifact &#39;XXX:war exploded&#39; because it is included into a circular dependency (artifact &#39;XXXX:war exploded&#39;, artifact &#39;XXX:war exploded&#39;) Idea启动项目报错解决方案

在Idea中使用Maven创建父子工程,第一个Model的那个项目可以很好的运行,在创建一个Model运行时报这个错.原因是tomcat部署了多个Web项目,可能最开始是两个项目的配置文件混用用,最后就报这个错. 网上找的解决方案: 步骤:File--  Porject Struccture ---- Artifacts 在Tomcat部署时war和war exploded区别: war模式:将WEB工程以包的形式上传到服务器 : war exploded模式:将WEB工程以当前文件夹的位置关系

Nginx部署Django项目报错 KeyError: &#39;REQUEST_METHOD&#39;

这个问题是应为Nginx的配置文件有问题: 要使用uwsgi启动Django的话要有以下配置: upstream djangos14{ # nginx负载均衡配置: server 10.0.0.10:9999; #server 10.0.0.11:80; } server { listen 80; server_name www.s14hanju.com; location / { # 要使用uwsgi,代理就不要用proxy_pass了,要使用uwsgi_pass: uwsgi_pass dj