BobSilverberg
BobSilverberg

Reputation: 1305

Error running django server from PyCharm with local settings file

I am trying to get my django server running from within PyCharm. I am able to start the server with no errors, but as soon as I browse to a page in the app I get the following error in the console:

pydev debugger: starting

Validating models...

0 errors found
Django version 1.4.10, using settings 'oneanddone.settings.local'
Development server is running at http://127.0.0.1:8000/
Quit the server with CONTROL-C.
Traceback (most recent call last):
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/wsgiref/handlers.py", line 85, in run
    self.result = application(self.environ, self.start_response)
  File "/Users/bsilverberg/gitRepos/oneanddone/vendor/lib/python/django/contrib/staticfiles/handlers.py", line 67, in __call__
    return self.application(environ, start_response)
  File "/Users/bsilverberg/gitRepos/oneanddone/vendor/lib/python/django/core/handlers/wsgi.py", line 241, in __call__
    response = self.get_response(request)
  File "/Users/bsilverberg/gitRepos/oneanddone/vendor/lib/python/django/core/handlers/base.py", line 82, in get_response
    urlconf = settings.ROOT_URLCONF
  File "/Users/bsilverberg/gitRepos/oneanddone/vendor/lib/python/django/utils/functional.py", line 185, in inner
    return func(self._wrapped, *args)
AttributeError: 'Settings' object has no attribute 'ROOT_URLCONF'
[09/Dec/2013 09:00:41] "GET /en-US/ HTTP/1.1" 500 59

I have a settings/local.py file and a settings/base.py file, and when I start the server from the terminal everything works fine. When starting from PyCharm I get the above error. My local settings file is getting loaded, as I can inspect the value of settings at this point in the code and can see my local values, but it seems like the settings from base.py are not being picked up (as that is where ROOT_URLCONF is defined).

So this doesn't seem to be an issue with DJANGO_SETTINGS_MODULE - it is finding the local.py file.

I'm running PyCharm 2.7.3 and django 1.4.

The most frustrating thing about this is that I had this working with a similar application a few months ago, and cannot figure out why it's not working now.

Upvotes: 1

Views: 1067

Answers (1)

BobSilverberg
BobSilverberg

Reputation: 1305

I just figured it out. All I had to do was point to the settings folder, instead of a specific file in the folder, and it all works.

Upvotes: 2

Related Questions