3

I can't get the dev environment running!

I've been following the instructions here (tutorial on DjangoProject page). When I type

manage.py runserver

I get the following error:

ImportError: No module named MYSITE

I am executing the command within the folder MYSITE which has the files init.py, manage.py, settings.py, urls.py

I've searched around and found questions on "manage.py runserver", but not this specific error. Your help is greatly appreciated. Thanks

4

3 回答 3

3

If you're using windows, you'll need to put your project's directory (the one with manage.py in it) into an environment variable called PYTHONPATH.

于 2011-03-25T05:01:46.837 回答
0

Since this is highly ranked on Google and I got here while searching for an answer I'll share my solution:

I have a project built on my machine, packaged into a debian package and installed on a test machine. On my machine I use the runserver but on the testmachine I use apache (which was using fine). When changing database from sqlite to postgresql I could not do shell or syncdb etc (all manage commands). The problem here was that manage.py was owned by www-data and it had to be root for these commands to work...

sudo chown root. manage.py
于 2012-06-04T09:16:17.940 回答
0

Another different answer ;) I'm walking the "Django for the Impatient: Building a Blog" chapter from "Python Web Development with Django" and it suggests creating a "dotted" module so I registered my application as "x.y" which it didn't like. Changing to "y" which matched the file-system as:

/x
 + manage.py
 + /x
   + settings.py
 + /y
   + models.py

Worked for me.

于 2013-06-08T20:40:11.700 回答