Friday, December 27, 2013

When creating a project in django using the tutorial at, I was getting an import error when running at the command line which asked if I was on the correct sys path using this command?: startproject mysite.

 ImportError: Could not import settings 'mysite.settings' (Is it on sys.path?): No 
module named mysite.setting

I tried various things including trying to set the environmental variables differently. I finally installed Python-2.7.6, an upgrade from Python 2.7.3 I was using, to solved the problem. To get a working system on Windows 8 I used Python 2.7.6, Django 1.6, msql-installer-community-, and MySQL-python-1.2.4b4.win32-py2.7. The trick is to find versions that work together. This can be done by trial and error since it is not always easy to find documentation that tells you. I tried to use the most recent stable releases of Django, Python, and MySQL.
To start the development server I attempted to run: 
 python runserver
I got:
  from django.core.exceptions import ImproperlyConfigured ... configured. " 
"Please supply the ENGINE value. Check ". "settings documentation for more details.")
This led me to believe that I needed to go back to the file. I 
double checked my settings but found nothing to correct this error. I remember 
reading something about setting the DJANGO_SETTINGS_MODULE in the Environment 
variables. I created a DJANGO_SETTINGS_MODULE variable in the environment system. I 
set it equal to C:/python_projects/mysite/ That didn't work but 
when I was in the outer mysite directory on the command line I used: 
set DJANGO_SETTINGS_MODULE= mysite.settings
and after that ran 
python runserver 
and had no problems after that continuing through the tutorial. 
 So once again I have run into compatibility problems with updates of software. Each 
release is a little different enough to cause problems. Users need to be aware of 
these conflicts that can occur so they have something else to try when they hit a 
brick wall in developing. 

No comments:

Post a Comment