0

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.

user3114321
  • 61
  • 3
  • 11
  • Can you post the full traceback. What version of Django are you using? Have you installed Django globally or are you using virtualenv? What OS are you using? – Timmy O'Mahony Mar 20 '14 at 14:13
  • Maybe you are removed part of django libraries. Try reinstall it. – pbacterio Mar 20 '14 at 14:14
  • I've re-installed it several times. I am using Django globally as I am in learning process and am not using it as full time programmer. I am using 1.5. Thrice I've downloaded by removing complete Django installer package to re do from scratch. In vain. Full TraceBack is one liner comment that's posted in initial post. – user3114321 Mar 20 '14 at 14:18
  • Try this http://stackoverflow.com/questions/5599872/python-windows-importerror-no-module-named-site – emnoor Mar 20 '14 at 14:21
  • I did tried that as that's why I mentioned in initial post that environment variable isn't the problem. However, I will try it again to ensure I haven't missed anything. – user3114321 Mar 20 '14 at 14:28
  • You can get into python from cmd doesn't mean PYTHONPATH variable is set. You can start python because it is in PATH. May be PYTHONPATH is not set. – emnoor Mar 20 '14 at 14:36
  • From cmd, type `set PYTHONPATH` to see if it is set. – emnoor Mar 20 '14 at 14:38
  • Tried everything but still the same error. – user3114321 Mar 20 '14 at 15:08
  • The only solution to this problem I can propose is to restore system to earlier point. It worked for me and would like to share this with all who are having same issue. – user3114321 Mar 21 '14 at 00:43

2 Answers2

0

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
0

You should use django-admin startproject PROJECT_NAME

Nilesh Gupta
  • 367
  • 1
  • 2