简体   繁体   中英

Cannot create project using Django

I've uninstalled 3.3 as I was working with Django and installed 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:

  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. 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 .

  • Deactivate the virtualenv
  • Install uWSGI system-wide (if not already installed system-wide)

sudo pip install uwsgi

  • Edit the uwsgi.ini file. I commented out the line with the

home = /path/to/virtualenv

  • Re-run the command: uWSGI --ini mysite_uwsgi.ini

您应该使用django-admin startproject PROJECT_NAME

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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