python - django tutorial no module named staticfilespolls error -
i had done first part of tutorial, got stuck, realized there several versions of tutorial, deleted polls , mysite directories , started again. however, when run
$ python manage.py sql polls result is:
c:\python27\scripts\mysite>python manage.py sql polls traceback (most recent call last): file "manage.py", line 10, in <module> execute_from_command_line(sys.argv) file "c:\python27\lib\site-packages\django\core\management\__init__.py", line 399, in execute_from_command_line utility.execute() file "c:\python27\lib\site-packages\django\core\management\__init__.py", line 392, in execute self.fetch_command(subcommand).run_from_argv(self.argv) file "c:\python27\lib\site-packages\django\core\management\base.py", line 242, in run_from_argv self.execute(*args, **options.__dict__) file "c:\python27\lib\site-packages\django\core\management\base.py", line 280, in execute translation.activate('en-us') file "c:\python27\lib\site-packages\django\utils\translation\__init__.py", lin e 130, in activate return _trans.activate(language) file "c:\python27\lib\site-packages\django\utils\translation\trans_real.py", l ine 188, in activate _active.value = translation(language) file "c:\python27\lib\site-packages\django\utils\translation\trans_real.py", l ine 177, in translation default_translation = _fetch(settings.language_code) file "c:\python27\lib\site-packages\django\utils\translation\trans_real.py", l ine 159, in _fetch app = import_module(appname) file "c:\python27\lib\site-packages\django\utils\importlib.py", line 40, in im port_module __import__(name) importerror: no module named staticfilespolls
in settings.py
installed_apps = ( 'django.contrib.admin', 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.messages', 'django.contrib.staticfiles' 'polls', ) databases = { 'default': { 'engine': 'django.db.backends.sqlite3', 'name': os.path.join(base_dir, 'db.sqlite3'), } }
i can't figure out error coming from.
you missing comma after django.contrib.staticfiles
in installed_apps
setting:
installed_apps = ( 'django.contrib.admin', 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.messages', 'django.contrib.staticfiles', # here 'polls', )
without comma, python interprets django.contrib.staticfiles
, polls
strings single one.
demo:
>>> s = ('what', ... 'a', ... 'wonderful' ... 'world') >>> s ('what', 'a', 'wonderfulworld') >>> s = ('what', ... 'a', ... 'wonderful', ... 'world') >>> s ('what', 'a', 'wonderful', 'world')
Comments
Post a Comment