I am having the same problem. I am following the instructions or at least trying to and have the stuff could not be found. One problem was that no "easy_install" existed. Another was "pip" did not exist. Finally I got through those parts, and found that the DJANGO_SETTINGS_MODULE environment variable could not be found. After several hours of searching, I edited the bashrc files to have it set. And now it tells me:
"ImportError: Could not import settings 'booktype.settings' (Is it on sys.path?): No module named booktype.settings"
Of course the file can not be found, it does not exist on my system because nothing ever created it. I am stuck on the syncdb step. Please help me as well.
"Createbooki" script will create Booktype project for you. Among other things, it will also create file with all nedded environment variables (DJANGO_SETTINGS_MODULE, PATH, ...). File is called "booki.env" and you should load it (step 6 in instructions) after you have changed all needed settings. Directory created with "createbooki" is your Booktype project, booki.env is including it in it PYTHONPATH and etc. After you have loaded ". ./booki.env" (step 6 in instructions) you should have all paths set.
I have already run createbooki script and ". ./booki.env" multiple times. I still have that error. I do not know what "all needed settings" means. If you would care to explain EXACTLY what settings I need to change, I will gladly change them to make this headache go away. I just tried again to make sure, and I still have the same error on step 7. Maybe I am giving you the wrong error or not enough information, so here it is:
dev@dev:/var/www/booktype$ django-admin syncdb --noinput Traceback (most recent call last): File "/usr/bin/django-admin", line 5, in <module> management.execute_from_command_line() File "/usr/lib/pymodules/python2.7/django/core/management/__init__.py", line 429, in execute_from_command_line utility.execute() File "/usr/lib/pymodules/python2.7/django/core/management/__init__.py", line 379, in execute self.fetch_command(subcommand).run_from_argv(self.argv) File "/usr/lib/pymodules/python2.7/django/core/management/__init__.py", line 261, in fetch_command klass = load_command_class(app_name, subcommand) File "/usr/lib/pymodules/python2.7/django/core/management/__init__.py", line 67, in load_command_class module = import_module('%s.management.commands.%s' % (app_name, name)) File "/usr/lib/pymodules/python2.7/django/utils/importlib.py", line 35, in import_module __import__(name) File "/usr/lib/pymodules/python2.7/django/core/management/commands/syncdb.py", line 7, in <module> from django.core.management.sql import custom_sql_for_model, emit_post_sync_signal File "/usr/lib/pymodules/python2.7/django/core/management/sql.py", line 6, in <module> from django.db import models File "/usr/lib/pymodules/python2.7/django/db/__init__.py", line 14, in <module> if not settings.DATABASES: File "/usr/lib/pymodules/python2.7/django/utils/functional.py", line 276, in __getattr__ self._setup() File "/usr/lib/pymodules/python2.7/django/conf/__init__.py", line 44, in _setup self._wrapped = Settings(settings_module) File "/usr/lib/pymodules/python2.7/django/conf/__init__.py", line 89, in __init__ mod = importlib.import_module(self.SETTINGS_MODULE) File "/usr/lib/pymodules/python2.7/django/utils/importlib.py", line 35, in import_module __import__(name) File "/var/www/booktype/settings.py", line 172, in <module> init_logging() File "/var/www/booktype/settings.py", line 163, in init_logging ch = logging.handlers.RotatingFileHandler('%s/logs/booki.log' % BOOKI_ROOT, maxBytes=100000, backupCount=5) File "/usr/lib/python2.7/logging/handlers.py", line 118, in __init__ BaseRotatingHandler.__init__(self, filename, mode, encoding, delay) File "/usr/lib/python2.7/logging/handlers.py", line 65, in __init__ logging.FileHandler.__init__(self, filename, mode, encoding, delay) File "/usr/lib/python2.7/logging/__init__.py", line 893, in __init__ StreamHandler.__init__(self, self._open()) File "/usr/lib/python2.7/logging/__init__.py", line 912, in _open stream = open(self.baseFilename, self.mode) IOError: [Errno 13] Permission denied: '/var/www/booktype/logs/booki.log' dev@dev:/var/www/booktype$ sudo django-admin syncdb --noinput Traceback (most recent call last): File "/usr/bin/django-admin", line 5, in <module> management.execute_from_command_line() File "/usr/lib/pymodules/python2.7/django/core/management/__init__.py", line 429, in execute_from_command_line utility.execute() File "/usr/lib/pymodules/python2.7/django/core/management/__init__.py", line 379, in execute self.fetch_command(subcommand).run_from_argv(self.argv) File "/usr/lib/pymodules/python2.7/django/core/management/__init__.py", line 261, in fetch_command klass = load_command_class(app_name, subcommand) File "/usr/lib/pymodules/python2.7/django/core/management/__init__.py", line 67, in load_command_class module = import_module('%s.management.commands.%s' % (app_name, name)) File "/usr/lib/pymodules/python2.7/django/utils/importlib.py", line 35, in import_module __import__(name) File "/usr/lib/pymodules/python2.7/django/core/management/commands/syncdb.py", line 7, in <module> from django.core.management.sql import custom_sql_for_model, emit_post_sync_signal File "/usr/lib/pymodules/python2.7/django/core/management/sql.py", line 6, in <module> from django.db import models File "/usr/lib/pymodules/python2.7/django/db/__init__.py", line 14, in <module> if not settings.DATABASES: File "/usr/lib/pymodules/python2.7/django/utils/functional.py", line 276, in __getattr__ self._setup() File "/usr/lib/pymodules/python2.7/django/conf/__init__.py", line 44, in _setup self._wrapped = Settings(settings_module) File "/usr/lib/pymodules/python2.7/django/conf/__init__.py", line 91, in __init__ raise ImportError("Could not import settings '%s' (Is it on sys.path?): %s" % (self.SETTINGS_MODULE, e)) ImportError: Could not import settings 'booktype.settings' (Is it on sys.path?): No module named booktype.settings
Okay, I just deleted everything, and tried fresh install. I get the following error following your guidelines:
dev@dev:/usr/www/mybooktype$ sudo vi settings.py dev@dev:/usr/www/mybooktype$ . ./booki.env dev@dev:/usr/www/mybooktype$ sudo django-admin syncdb --noinput Traceback (most recent call last): File "/usr/bin/django-admin", line 5, in <module> management.execute_from_command_line() File "/usr/lib/pymodules/python2.7/django/core/management/__init__.py", line 429, in execute_from_command_line utility.execute() File "/usr/lib/pymodules/python2.7/django/core/management/__init__.py", line 379, in execute self.fetch_command(subcommand).run_from_argv(self.argv) File "/usr/lib/pymodules/python2.7/django/core/management/__init__.py", line 261, in fetch_command klass = load_command_class(app_name, subcommand) File "/usr/lib/pymodules/python2.7/django/core/management/__init__.py", line 67, in load_command_class module = import_module('%s.management.commands.%s' % (app_name, name)) File "/usr/lib/pymodules/python2.7/django/utils/importlib.py", line 35, in import_module __import__(name) File "/usr/lib/pymodules/python2.7/django/core/management/commands/syncdb.py", line 7, in <module> from django.core.management.sql import custom_sql_for_model, emit_post_sync_signal File "/usr/lib/pymodules/python2.7/django/core/management/sql.py", line 6, in <module> from django.db import models File "/usr/lib/pymodules/python2.7/django/db/__init__.py", line 14, in <module> if not settings.DATABASES: File "/usr/lib/pymodules/python2.7/django/utils/functional.py", line 276, in __getattr__ self._setup() File "/usr/lib/pymodules/python2.7/django/conf/__init__.py", line 44, in _setup self._wrapped = Settings(settings_module) File "/usr/lib/pymodules/python2.7/django/conf/__init__.py", line 91, in __init__ raise ImportError("Could not import settings '%s' (Is it on sys.path?): %s" % (self.SETTINGS_MODULE, e)) ImportError: Could not import settings 'booktype.settings' (Is it on sys.path?): No module named booktype.settings dev@dev:/usr/www/mybooktype$ cd /usr/lib/pymodules/python2.7/django/conf dev@dev:/usr/lib/pymodules/python2.7/django/conf$ sudo vi __init__.py dev@dev:/usr/lib/pymodules/python2.7/django/conf$ cd /usr/www/mybooktype/dev@dev:/usr/www/mybooktype$ sudo django-admin syncdb --noinput Traceback (most recent call last): File "/usr/bin/django-admin", line 5, in <module> management.execute_from_command_line() File "/usr/lib/pymodules/python2.7/django/core/management/__init__.py", line 429, in execute_from_command_line utility.execute() File "/usr/lib/pymodules/python2.7/django/core/management/__init__.py", line 379, in execute self.fetch_command(subcommand).run_from_argv(self.argv) File "/usr/lib/pymodules/python2.7/django/core/management/__init__.py", line 261, in fetch_command klass = load_command_class(app_name, subcommand) File "/usr/lib/pymodules/python2.7/django/core/management/__init__.py", line 67, in load_command_class module = import_module('%s.management.commands.%s' % (app_name, name)) File "/usr/lib/pymodules/python2.7/django/utils/importlib.py", line 35, in import_module __import__(name) File "/usr/lib/pymodules/python2.7/django/core/management/commands/syncdb.py", line 7, in <module> from django.core.management.sql import custom_sql_for_model, emit_post_sync_signal File "/usr/lib/pymodules/python2.7/django/core/management/sql.py", line 6, in <module> from django.db import models File "/usr/lib/pymodules/python2.7/django/db/__init__.py", line 14, in <module> if not settings.DATABASES: File "/usr/lib/pymodules/python2.7/django/utils/functional.py", line 276, in __getattr__ self._setup() File "/usr/lib/pymodules/python2.7/django/conf/__init__.py", line 42, in _setup raise ImportError("Settings cannot be imported, because environment variable %s is undefined." % ENVIRONMENT_VARIABLE) ImportError: Settings cannot be imported, because environment variable DJANGO_SETTINGS_MODULE is undefined.
Reply to @Fred: Hi Fred... ok.. So, you have used createbooki to install Booktype project into /usr/www/mybooktype? Check your booki.env file. You must have: export DJANGO_SETTINGS_MODULE=mybooktype.settings and export PYTHONPATH=$PYTHONPATH:/usr/www/ defined. Looking at this errors you can see that Django thinks settings module is booktype.settings. Did you rename directory or something? Check your booki.env file, correct values if they are wrong, load booki.env again and try again.
I am thinking the problem might stem from not being able to run ". ./booki.env" as a superuser. Either that, or because the settings file itself is not on my system. Regardless, I restarted my system, and now I am back to the DJANGO_SETTINGS_MODULE environment variable being not found. When I try to run django-admin without the sudo in front, it says permission denied. I think that may cause the error, if not I am clueless and frustrated. See below:
dev@dev:/usr/www/mybooktype$ . ./booki.env dev@dev:/usr/www/mybooktype$ sudo django-admin syncdb --noinput Traceback (most recent call last): File "/usr/bin/django-admin", line 5, in <module> management.execute_from_command_line() File "/usr/lib/pymodules/python2.7/django/core/management/__init__.py", line 429, in execute_from_command_line utility.execute() File "/usr/lib/pymodules/python2.7/django/core/management/__init__.py", line 379, in execute self.fetch_command(subcommand).run_from_argv(self.argv) File "/usr/lib/pymodules/python2.7/django/core/management/__init__.py", line 261, in fetch_command klass = load_command_class(app_name, subcommand) File "/usr/lib/pymodules/python2.7/django/core/management/__init__.py", line 67, in load_command_class module = import_module('%s.management.commands.%s' % (app_name, name)) File "/usr/lib/pymodules/python2.7/django/utils/importlib.py", line 35, in import_module __import__(name) File "/usr/lib/pymodules/python2.7/django/core/management/commands/syncdb.py", line 7, in <module> from django.core.management.sql import custom_sql_for_model, emit_post_sync_signal File "/usr/lib/pymodules/python2.7/django/core/management/sql.py", line 6, in <module> from django.db import models File "/usr/lib/pymodules/python2.7/django/db/__init__.py", line 14, in <module> if not settings.DATABASES: File "/usr/lib/pymodules/python2.7/django/utils/functional.py", line 276, in __getattr__ self._setup() File "/usr/lib/pymodules/python2.7/django/conf/__init__.py", line 42, in _setup raise ImportError("Settings cannot be imported, because environment variable %s is undefined." % ENVIRONMENT_VARIABLE) ImportError: Settings cannot be imported, because environment variable DJANGO_SETTINGS_MODULE is undefined. dev@dev:/usr/www/mybooktype$