简体   繁体   English

无法使用Django创建项目

[英]Cannot create project using Django

I've uninstalled 3.3 as I was working with Django and installed Python 2.7. 在使用Django时,我已经卸载了3.3,并安装了Python 2.7。 But now I couldn't create project. 但是现在我无法创建项目。 I've un-installed Django and Python both and tried different versions but every time when I try to create a project with "django-admin.py startproject abc" it gives me some error: 我已经同时卸载了Django和Python,并尝试了不同的版本,但是每次我尝试使用“ django-admin.py startproject abc”创建项目时,都会出现一些错误:

  ImportError: No module named site

I've searched for a solution thoroughly tried different ways but this doesn't goes away. 我一直在寻找解决方案,尝试过不同的方法,但这并没有消失。 I can get into Python by typing in Python from command prompt so this isn't related to environment variable. 我可以通过在命令提示符下键入Python来进入Python,所以这与环境变量无关。 Please help. 请帮忙。

Here's how I resolved the same error message (ImportError: No module named site) that I got while trying this tutorial: https://uwsgi.readthedocs.org/en/latest/tutorials/Django_and_nginx.html . 这是解决我在尝试本教程时遇到的错误消息(ImportError:没有名为站点的模块)的相同方法: https : //uwsgi.readthedocs.org/en/latest/tutorials/Django_and_nginx.html

  • Deactivate the virtualenv 停用virtualenv
  • Install uWSGI system-wide (if not already installed system-wide) 在系统范围内安装uWSGI(如果尚未在系统范围内安装)

sudo pip install uwsgi sudo pip安装uwsgi

  • Edit the uwsgi.ini file. 编辑uwsgi.ini文件。 I commented out the line with the 我评论了与

home = /path/to/virtualenv 主页= / path / to / virtualenv

  • Re-run the command: uWSGI --ini mysite_uwsgi.ini 重新运行命令:uWSGI --ini mysite_uwsgi.ini

您应该使用django-admin startproject PROJECT_NAME

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM