ecprice / newsdiffs

Automatic scraper that tracks changes in news articles over time.
Other
494 stars 135 forks source link

ImportError: Could not import settings 'website.settings' (Is it on sys.path?): No module named website.settings #25

Open ShahriyarR opened 9 years ago

ShahriyarR commented 9 years ago

For testing purposes i just cloned and changed all necessary database related settings. After all getting an import error:

(django_env)sh@sh--work:~/Repos/newsdiffs$ python website/manage.py syncdb
Traceback (most recent call last):
  File "website/manage.py", line 17, in <module>
    execute_from_command_line(sys.argv)
  File "/home/sh/django_env/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 453, in execute_from_command_line
    utility.execute()
  File "/home/sh/django_env/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 392, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/home/sh/django_env/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 263, in fetch_command
    app_name = get_commands()[subcommand]
  File "/home/sh/django_env/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 109, in get_commands
    apps = settings.INSTALLED_APPS
  File "/home/sh/django_env/local/lib/python2.7/site-packages/django/conf/__init__.py", line 52, in __getattr__
    self._setup(name)
  File "/home/sh/django_env/local/lib/python2.7/site-packages/django/conf/__init__.py", line 47, in _setup
    self._wrapped = Settings(settings_module)
  File "/home/sh/django_env/local/lib/python2.7/site-packages/django/conf/__init__.py", line 132, in __init__
    raise ImportError("Could not import settings '%s' (Is it on sys.path?): %s" % (self.SETTINGS_MODULE, e))
ImportError: Could not import settings 'website.settings' (Is it on sys.path?): No module named website.settings
miguelcarvajal commented 9 years ago

Same here. Did you solve this @ShahriyarR?

ShahriyarR commented 9 years ago

@miguelcarvajal --- Problem is still here as we :)

ghost commented 9 years ago

I'm having the same problem. Have either of you managed to find a solution? Thanks.

Fil commented 9 years ago

found it! here's the patch that works for me (on Mac OS X):

diff --git a/website/manage.py b/website/manage.py
index 6fd85de..333e602 100755
--- a/website/manage.py
+++ b/website/manage.py
@@ -11,7 +11,7 @@ except OSError:

 if __name__ == "__main__":
     os.environ.setdefault("DJANGO_SETTINGS_MODULE", "website.settings")
-    sys.path.append(os.path.dirname(os.getcwd()))
+    sys.path.append(os.getcwd())
     from django.core.management import execute_from_command_line

     execute_from_command_line(sys.argv)
ryantate commented 9 years ago

The @cwage fork fixed this for me, thanks much.

lupa18 commented 7 years ago

here same problem :(