Im on installing edX platform using this instructions ( http://nkokkos.wordpress.com/2013/10/09/setting-up-edx-platform-on-ubutnu/ ),
I followed; every step successfully, but on ./manage.py lms syncdb –migrate, I face to this error:
Traceback (most recent call last):
File "manage.py", line 90, in <module>
startup = importlib.import_module(edx_args.startup)
File "/usr/lib/python2.7/importlib/__init__.py", line 37, in import_module
__import__(name)
File "/home/peyman/dev/edx/lms/startup.py", line 9, in <module>
settings.INSTALLED_APPS # pylint: disable=W0104
File "/usr/local/lib/python2.7/dist-packages/django/conf/__init__.py", line 53, in __getattr__
self._setup(name)
File "/usr/local/lib/python2.7/dist-packages/django/conf/__init__.py", line 48, in _setup
self._wrapped = Settings(settings_module)
File "/usr/local/lib/python2.7/dist-packages/django/conf/__init__.py", line 134, in __init__
raise ImportError("Could not import settings '%s' (Is it on sys.path?): %s" % (self.SETTINGS_MODULE, e))
ImportError: Could not import settings 'lms.envs.dev' (Is it on sys.path?): No module named xblock.fields
How can I fix it?
For anyone landing here for trouble with Open edX installation, try this latest guide instead of the one linked above:
http://edx.readthedocs.io/projects/edx-installing-configuring-and-running/en/latest/
i checked the code accordingly in your edx-platform folder structure, look for lms\envs\ there many environment file for migration exists
Related
Just upgraded from django 1.8 to 1.9 and getting this error while migrating:
Error importing devserver module devserver.modules.sql: "cannot import name util"
Although they say it is fixed it here:
https://github.com/dcramer/django-devserver/issues/131
[localhost] local: python manage.py migrate
Traceback (most recent call last):
File "manage.py", line 10, in <module>
execute_from_command_line(sys.argv)
File "/home/halit/project_folder/.venv/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 350, in execute_from_command_line
utility.execute()
File "/home/halit/project_folder/.venv/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 324, in execute
django.setup()
File "/home/halit/project_folder/.venv/local/lib/python2.7/site-packages/django/__init__.py", line 18, in setup
apps.populate(settings.INSTALLED_APPS)
File "/home/halit/project_folder/.venv/local/lib/python2.7/site-packages/django/apps/registry.py", line 108, in populate
app_config.import_models(all_models)
File "/home/halit/project_folder/.venv/local/lib/python2.7/site-packages/django/apps/config.py", line 202, in import_models
self.models_module = import_module(models_module_name)
File "/usr/lib/python2.7/importlib/__init__.py", line 37, in import_module
__import__(name)
File "/home/halit/project_folder./venv/local/lib/python2.7/site-packages/devserver/models.py", line 40, in <module>
load_modules()
File "/home/halit/project_folder/.venv/local/lib/python2.7/site-packages/devserver/models.py", line 25, in load_modules
raise exceptions.ImproperlyConfigured, 'Error importing devserver module %s: "%s"' % (name, e)
django.core.exceptions.ImproperlyConfigured: Error importing devserver module devserver.modules.sql: "cannot import name util"
Fatal error: local() encountered an error (return code 1) while executing 'python manage.py migrate'
Aborting.
I was having the same problem. Editing the usr/local/lib/python2.7/dist-packages/devserver/modules/sql.py file and changing the import on line 15 from:
from django.db.backends import util
to
from django.db.backends import utils
Seemed to do it. I had to change all the references in the file from util to utils.
When I try to run python manage.py runserver I get this error:
Traceback (most recent call last):
File "manage.py", line 22, in <module>
execute_from_command_line(sys.argv)
File "/Users/user/lokvi/lokvi_env/lib/python2.7/site-packages/django/core/management/__init__.py", line 363, in execute_from_command_line
utility.execute()
File "/Users/user/lokvi/lokvi_env/lib/python2.7/site-packages/django/core/management/__init__.py", line 307, in execute
settings.INSTALLED_APPS
File "/Users/user/lokvi/lokvi_env/lib/python2.7/site-packages/django/conf/__init__.py", line 56, in __getattr__
self._setup(name)
File "/Users/user/lokvi/lokvi_env/lib/python2.7/site-packages/django/conf/__init__.py", line 41, in _setup
self._wrapped = Settings(settings_module)
File "/Users/user/lokvi/lokvi_env/lib/python2.7/site-packages/django/conf/__init__.py", line 110, in __init__
mod = importlib.import_module(self.SETTINGS_MODULE)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/importlib/__init__.py", line 37, in import_module
__import__(name)
ImportError: No module named settings
I have python 2.7 in my virtualenv. I noticed strange thing at the last lines of my stack trace, the line before the last line has path that goes like that: /lokvi_env/lib/python2.7 etc
But the last line goes like that System/Library/Frameworks etc, so it seems like path has changed from virtualenv to system. Is it ok?
You need to import settings module
from django.conf import settings
Oh, It was not the python path specific question, sorry. I just needed __init__.py in settings module inside of my project, since there were no settings it tried to find it in python lib itself and couldn't, I believe.
pycharm#glenn-liveconsole3:~/mysite/quickstart$ django-admin.py syncdb
Traceback (most recent call last):
File "/home/pycharm/.virtualenvs/anchondo/bin/django-admin.py", line 5, in <module>
management.execute_from_command_line()
File "/home/pycharm/.virtualenvs/anchondo/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 453, in execute_from_command
_line
utility.execute()
File "/home/pycharm/.virtualenvs/anchondo/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/pycharm/.virtualenvs/anchondo/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 272, in fetch_command
klass = load_command_class(app_name, subcommand)
File "/home/pycharm/.virtualenvs/anchondo/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 77, in load_command_class
module = import_module('%s.management.commands.%s' % (app_name, name))
File "/home/pycharm/.virtualenvs/anchondo/local/lib/python2.7/site-packages/django/utils/importlib.py", line 35, in import_module
__import__(name)
File "/home/pycharm/.virtualenvs/anchondo/local/lib/python2.7/site-packages/django/core/management/commands/syncdb.py", line 8, in <module>
from django.core.management.sql import custom_sql_for_model, emit_post_sync_signal
File "/home/pycharm/.virtualenvs/anchondo/local/lib/python2.7/site-packages/django/core/management/sql.py", line 9, in <module>
from django.db import models
File "/home/pycharm/.virtualenvs/anchondo/local/lib/python2.7/site-packages/django/db/__init__.py", line 11, in <module>
if settings.DATABASES and DEFAULT_DB_ALIAS not in settings.DATABASES:
File "/home/pycharm/.virtualenvs/anchondo/local/lib/python2.7/site-packages/django/conf/__init__.py", line 53, in __getattr__
self._setup(name)
File "/home/pycharm/.virtualenvs/anchondo/local/lib/python2.7/site-packages/django/conf/__init__.py", line 46, in _setup
% (desc, ENVIRONMENT_VARIABLE))
django.core.exceptions.ImproperlyConfigured: Requested setting DATABASES, but settings are not configured. You must either define the environment va
riable DJANGO_SETTINGS_MODULE or call settings.configure() before accessing settings.
All I am doing is running python manage.py syncdb or python manage.py migrate I am trying to update the website the models created a new model an am trying to migrate the info website works but I can not do syncdb in the console
When you create your project with django-admin startproject a manage.py will be generated that has a line like:
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "my_project.settings")
where my_project is your project name. This points to your settings file. Make sure the line exists and point to the right settings module.
Also use manage.py instead of django-admin to manage an existing project.
I'm writing this post because after hours of research around, no real solution was found about my issue.
I've a Django project that used to run on another computer. Now, I've a new one, I've reinstalled Django and VirtualEnvWrapper.
I've cloned my project from my git and I can work and deploy without any issues.
Running ./manage.py works when I'm on the correct virtualenv (via workon 'my_project_name').
My problem is that I can't generate translations any more.
Here is the trace-back:
(MyProject)--- python/MyProject ‹master*➔ M› »django-admin.py makemessages --all
Traceback (most recent call last):
File "/usr/local/bin/django-admin.py", line 5, in <module>
management.execute_from_command_line()
File "/Library/Python/2.7/site-packages/django/core/management/__init__.py", line 399, in execute_from_command_line
utility.execute()
File "/Library/Python/2.7/site-packages/django/core/management/__init__.py", line 376, in execute
sys.stdout.write(self.main_help_text() + '\n')
File "/Library/Python/2.7/site-packages/django/core/management/__init__.py", line 240, in main_help_text
for name, app in six.iteritems(get_commands()):
File "/Library/Python/2.7/site-packages/django/core/management/__init__.py", line 107, in get_commands
apps = settings.INSTALLED_APPS
File "/Library/Python/2.7/site-packages/django/conf/__init__.py", line 54, in __getattr__
self._setup(name)
File "/Library/Python/2.7/site-packages/django/conf/__init__.py", line 49, in _setup
self._wrapped = Settings(settings_module)
File "/Library/Python/2.7/site-packages/django/conf/__init__.py", line 132, in __init__
% (self.SETTINGS_MODULE, e)
ImportError: Could not import settings 'MyProject.settings.local' (Is it on sys.path? Is there an import error in the settings file?): No module named MyProject.settings.local
When I'm checking my sys.path, here is the content:
/Users/jbcollet/.virtualenvs/MyProject/lib/python27.zip
/Users/jbcollet/.virtualenvs/MyProject/lib/python2.7
/Users/jbcollet/.virtualenvs/MyProject/lib/python2.7/plat-darwin
/Users/jbcollet/.virtualenvs/MyProject/lib/python2.7/plat-mac
/Users/jbcollet/.virtualenvs/MyProject/lib/python2.7/plat-mac/lib-scriptpackages
/Users/jbcollet/.virtualenvs/MyProject/Extras/lib/python
/Users/jbcollet/.virtualenvs/MyProject/lib/python2.7/lib-tk
/Users/jbcollet/.virtualenvs/MyProject/lib/python2.7/lib-old
/Users/jbcollet/.virtualenvs/MyProject/lib/python2.7/lib-dynload
/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7
/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-darwin
/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-tk
/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac
/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac/lib-scriptpackages
/Users/jbcollet/.virtualenvs/MyProject/lib/python2.7/site-packages
Can someone help me with this?
Thanks a lot
I have the following on my MacBook with Osx Lion:
Mysql running with xampp (http://www.apachefriends.org/it/xampp.html)
Django 1.3 running in a virtualenv
I installed Mysql-python with pip install MySQL-python
but when trying to use manage.py syncdb I get the following error:
(django_1.3)Daniel-Mac:fz_biblio daniel$ python manage.py syncdb
Traceback (most recent call last):
File "manage.py", line 14, in <module>
execute_manager(settings)
File "/Users/daniel/Sites/django-proj/virtual-env/django_1.3/lib/python2.5/site-packages/django/core/management/__init__.py", line 438, in execute_manager
utility.execute()
File "/Users/daniel/Sites/django-proj/virtual-env/django_1.3/lib/python2.5/site-packages/django/core/management/__init__.py", line 379, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/Users/daniel/Sites/django-proj/virtual-env/django_1.3/lib/python2.5/site-packages/django/core/management/__init__.py", line 261, in fetch_command
klass = load_command_class(app_name, subcommand)
File "/Users/daniel/Sites/django-proj/virtual-env/django_1.3/lib/python2.5/site-packages/django/core/management/__init__.py", line 67, in load_command_class
module = import_module('%s.management.commands.%s' % (app_name, name))
File "/Users/daniel/Sites/django-proj/virtual-env/django_1.3/lib/python2.5/site-packages/django/utils/importlib.py", line 35, in import_module
__import__(name)
File "/Users/daniel/Sites/django-proj/virtual-env/django_1.3/lib/python2.5/site-packages/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 "/Users/daniel/Sites/django-proj/virtual-env/django_1.3/lib/python2.5/site-packages/django/core/management/sql.py", line 6, in <module>
from django.db import models
File "/Users/daniel/Sites/django-proj/virtual-env/django_1.3/lib/python2.5/site-packages/django/db/__init__.py", line 78, in <module>
connection = connections[DEFAULT_DB_ALIAS]
File "/Users/daniel/Sites/django-proj/virtual-env/django_1.3/lib/python2.5/site-packages/django/db/utils.py", line 93, in __getitem__
backend = load_backend(db['ENGINE'])
File "/Users/daniel/Sites/django-proj/virtual-env/django_1.3/lib/python2.5/site-packages/django/db/utils.py", line 33, in load_backend
return import_module('.base', backend_name)
File "/Users/daniel/Sites/django-proj/virtual-env/django_1.3/lib/python2.5/site-packages/django/utils/importlib.py", line 35, in import_module
__import__(name)
File "/Users/daniel/Sites/django-proj/virtual-env/django_1.3/lib/python2.5/site-packages/django/db/backends/mysql/base.py", line 14, in <module>
raise ImproperlyConfigured("Error loading MySQLdb module: %s" % e)
django.core.exceptions.ImproperlyConfigured: Error loading MySQLdb module: dlopen(/Users/daniel/.python-eggs/MySQL_python-1.2.3-py2.5-macosx-10.7-i386.egg-tmp/_mysql.so, 2): no suitable image found. Did find:
/Users/daniel/.python-eggs/MySQL_python-1.2.3-py2.5-macosx-10.7-i386.egg-tmp/_mysql.so: mach-o, but wrong architecture
(django_1.3)Daniel-Mac:fz_biblio daniel$ mate "/Users/daniel/Sites/django-proj/virtual-env/django_1.3/lib/python2.5/site-packages/django/db/backends/mysql/base.py
> "
(django_1.3)Daniel-Mac:fz_biblio daniel$ mate /Users/daniel/Sites/django-proj/virtual-env/django_1.3/lib/python2.5/site-packages/django/db/backends/mysql/base.py
Any idea in order to make django work with mysql in my environment?!?!
I finally sorted out the problem installing the right version of MySQL for my machine.
I installed MySQL 64bit version --> Mac OS X ver. 10.6 (x86, 64-bit)
After installing it Everything started working fine. I guess it was due to the fact that my previous installation was a 32bit one, that why mysql-python was complaining for the wrong architecture.