Fancy django error import options

I have many projects running in ubuntu with python2.7 and virtualenv / virtualenvwrapper, in my work some developers work with macosx and windows, as a rule, I create the project as usual:

django-admin.py start project x 

And we use svn for cvs, but at some point, without anything rational for me, when I try something like:

 python manage.py runserver 

does not work, but it is only for me and in my laptop that does not happen on production servers or other developers.

any ideas?

I got this error:

Error: Cannot find the file 'settings.py' in the directory containing 'Manage.py. You seem to have tuned things. You will have to run django-admin.py, passing it your settings module. (If the settings.py file really exists, leading to an ImportError.)

But, obviously, the settings file exists and is located in the same folder of the manage.py file and does not work only for me ...

This also happens with django and appengine

+8
python django django-settings settings importerror
source share
3 answers

I got this error:

Error: Cannot find the file "settings.py" in the directory containing "manage.py". You seem to have tuned things. You will need to run django-admin.py, passing it your settings module. (If the settings.py file really exists, it raises importError somehow.)

manage.py script prints this warning whenever an import error occurs, so if your settings.py module imports stuff and causes an import error, manage.py will still print this warning.

One way to diagnose this is to (temporarily) change manage.py from

 #!/usr/bin/env python from django.core.management import execute_manager try: import settings # Assumed to be in the same directory. except ImportError: import sys sys.stderr.write("Error: Can't find the file 'settings.py' in the directory containing %r. It appears you've customized things.\nYou'll have to run django-admin.py, passing it your settings module.\n(If the file settings.py does indeed exist, it causing an ImportError somehow.)\n" % __file__) sys.exit(1) if __name__ == "__main__": execute_manager(settings) 

to

 #!/usr/bin/env python from django.core.management import execute_manager import settings # Assumed to be in the same directory. if __name__ == "__main__": execute_manager(settings) 

and see the stack trace that will be printed when $ python manage.py runserver .

+28
source share

If you get this error when trying to get started with django and appengine, following the guide at http://www.allbuttonspressed.com/projects/djangoappengine

and you created symbolic links in folders, the manual is incorrect by creating a symbolic link djangoappengine. You need to go to 1 directory, for example.

NOT

Copy the following folders into your project (e.g. django-testapp):

 django-nonrel/django => <project>/django djangotoolbox/djangotoolbox => <project>/djangotoolbox django-autoload/autoload => <project>/autoload django-dbindexer/dbindexer => <project>/dbindexer djangoappengine => <project>/djangoappengine 

FIXED:

Copy the following folders into your project (e.g. django-testapp):

 django-nonrel/django => <project>/django djangotoolbox/djangotoolbox => <project>/djangotoolbox django-autoload/autoload => <project>/autoload django-dbindexer/dbindexer => <project>/dbindexer djangoappengine/djangoappengine => <project>/djangoappengine 

Pay attention to the last line.

+3
source share

I tried everything through the django code for an hour until I came across this:

 manage.py [command] --traceback 

Turns out there was an import error in my application. As soon as I saw the error, it took ten seconds to fix the error.: /

+1
source share

All Articles