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

XYZ91525
  • 33
  • 1
  • 3

3 Answers3

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.

orokusaki
  • 55,146
  • 59
  • 179
  • 257
  • No prob, if that doesn't work, do some Googling; it's very common for this to happen and there are a few things that can go wrong. – orokusaki Mar 25 '11 at 05:04
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
olofom
  • 6,233
  • 11
  • 37
  • 50
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.

Raymond Kroeker
  • 525
  • 1
  • 5
  • 13