Django Local Installation syncdb ImproperlyConfigured - python

I have been struggling to get a local django installation set up on a mac osx10.6.8. Running syncdb fails to recognize the apps that I have installed.
admins-macbook:myproject Admin$ python manage.py syncdb
Traceback (most recent call last):
File "manage.py", line 10, in <module>
execute_from_command_line(sys.argv)
File "/Users/Admin/myapp/lib/python2.7/site-packages/django/core/management/__init__.py", line 443, in execute_from_command_line
utility.execute()
File "/Users/Admin/myapp/lib/python2.7/site-packages/django/core/management/__init__.py", line 382, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/Users/Admin/myapp/lib/python2.7/site-packages/django/core/management/__init__.py", line 261, in fetch_command
klass = load_command_class(app_name, subcommand)
File "/Users/Admin/myapp/lib/python2.7/site-packages/django/core/management/__init__.py", line 69, in load_command_class
module = import_module('%s.management.commands.%s' % (app_name, name))
File "/Users/Admin/myapp/lib/python2.7/site-packages/django/utils/importlib.py", line 35, in import_module
__import__(name)
File "/Users/Admin/myapp/lib/python2.7/site-packages/south/management/commands/__init__.py", line 10, in <module>
import django.template.loaders.app_directories
File "/Users/Admin/myapp/lib/python2.7/site-packages/django/template/loaders/app_directories.py", line 23, in <module>
raise ImproperlyConfigured('ImportError %s: %s' % (app, e.args[0]))
django.core.exceptions.ImproperlyConfigured: ImportError haystack: cannot import name openProc
I have installed all the apps in the requirements.txt and they exist in the
lib/python2.7/site-packages/
directory. It is on my pythonpath:
admins-macbook:myproject Admin$ echo $PATH
/Users/Admin/myapp/lib/python2.7/site-packages:(... etc.)
How can I properly run syncdb? Thanks for your ideas!

you may installed pip install haystack which is wrong.
you need to install dyango haystack by pip install django-haystack
please refer this SO question

Related

No module named django_select2

I'm trying to run an example from the django-SHOP framework. Following their tutorial on running the example, I get the following error:
Traceback (most recent call last):
File "./manage.py", line 10, in <module>
execute_from_command_line(sys.argv)
File "/home/agozie/anaconda3/envs/env1/lib/python2.7/site-packages/django/core/management/__init__.py", line 364, in execute_from_command_line
utility.execute()
File "/home/agozie/anaconda3/envs/env1/lib/python2.7/site-packages/django/core/management/__init__.py", line 338, in execute
django.setup()
File "/home/agozie/anaconda3/envs/env1/lib/python2.7/site-packages/django/__init__.py", line 27, in setup
apps.populate(settings.INSTALLED_APPS)
File "/home/agozie/anaconda3/envs/env1/lib/python2.7/site-packages/django/apps/registry.py", line 85, in populate
app_config = AppConfig.create(entry)
File "/home/agozie/anaconda3/envs/env1/lib/python2.7/site-packages/django/apps/config.py", line 94, in create
module = import_module(entry)
File "/home/agozie/anaconda3/envs/env1/lib/python2.7/importlib/__init__.py", line 37, in import_module
__import__(name)
ImportError: No module named django_select2
I've installed django_select2 but it still throws the error. Any ideas?
Installing stripe through conda throws the error
CondaValueError: too few arguments, must supply command line package specs or --file
Is it installed?
Please run:
pip install django_select2
If you're using anaconda, try:
conda install -c django_select2
You can also do:
activate /home/agozie/anaconda3/envs/env1
pip install django_select2

django project not working in virtualenv

I recently installed a virtualenv and cloned an existing django project into it. When I run python manage.py runserver I'm getting the following error:
Traceback (most recent call last):
File "manage.py", line 22, in <module>
execute_from_command_line(sys.argv)
File "/Users/user/eb-virt/lib/python2.7/site-packages/django/core/management/__init__.py", line 443, in execute_from_command_line
utility.execute()
File "/Users/user/eb-virt/lib/python2.7/site-packages/django/core/management/__init__.py", line 382, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/Users/user/eb-virt/lib/python2.7/site-packages/django/core/management/__init__.py", line 261, in fetch_command
klass = load_command_class(app_name, subcommand)
File "/Users/user/eb-virt/lib/python2.7/site-packages/django/core/management/__init__.py", line 69, in load_command_class
module = import_module('%s.management.commands.%s' % (app_name, name))
File "/Users/user/eb-virt/lib/python2.7/site-packages/django/utils/importlib.py", line 35, in import_module
__import__(name)
File "/Users/user/eb-virt/lib/python2.7/site-packages/django/core/management/commands/runserver.py", line 8, in <module>
from django.core.servers.basehttp import AdminMediaHandler, run, WSGIServerException, get_internal_wsgi_application
File "/Users/user/eb-virt/lib/python2.7/site-packages/django/core/servers/basehttp.py", line 26, in <module>
from django.views import static
File "/Users/user/eb-virt/lib/python2.7/site-packages/django/views/static.py", line 95, in <module>
template_translatable = ugettext_noop(u"Index of %(directory)s")
File "/Users/user/eb-virt/lib/python2.7/site-packages/django/utils/translation/__init__.py", line 75, in gettext_noop
return _trans.gettext_noop(message)
File "/Users/user/eb-virt/lib/python2.7/site-packages/django/utils/translation/__init__.py", line 48, in __getattr__
if settings.USE_I18N:
File "/Users/user/eb-virt/lib/python2.7/site-packages/django/utils/functional.py", line 184, in inner
self._setup()
File "/Users/user/eb-virt/lib/python2.7/site-packages/django/conf/__init__.py", line 42, in _setup
self._wrapped = Settings(settings_module)
File "/Users/user/eb-virt/lib/python2.7/site-packages/django/conf/__init__.py", line 95, in __init__
raise ImportError("Could not import settings '%s' (Is it on sys.path?): %s" % (self.SETTINGS_MODULE, e))
ImportError: Could not import settings 'application-name.settings' (Is it on sys.path?): No module named application-name.settings
when I try doing application-name/application python manage.py runserver, I get the following error:
python: can't open file 'manage.py': [Errno 2] No such file or directory
here is the application directory
application-name/
manage.py
application/
__init__.py
urls.py
wsgi.py
settings.py
First, rename your application-name to application_name. Dashes and Python source is just inviting problems, best not wake the dragons.
Let's assume you've put it in ~/work/application_name, i.e. outside your virtualenv.
If you didn't create the virtualenv with virtualenvwrapper and it doesn't have a setup.py file, then delete it (and install virtualenvwrapper).
Create your virtualenv with virtualenvwrapper:
mkvirtualenv -a ~/work/application_name -r ~/work/application_name/requirements.txt eb_virt
-a add an existing directory as a project dir (puts it on the python path for this virtualenv). -r runs pip install -r on the argument (I'm assuming application_name/requirements.txt exists).
Instead of using the -a option (and assuming application_name/setup.py exists), you can install your package in development mode :
cd ~/work
pip install -e application_name
Either of these make ~/work/application_name part of the module search path when Python is running. Your settings file path must start relative to a directory on Python's module search path.
The DJANGO_SETTINGS_MODULE environment variable, should therefore be set to 'application.settings'.

Importing existing project from PIL to Pillow

I've got a django (1.5.1) project. This project was built with PIL. Nowadays pip use only Pillow.
I ran my virtualenv, cd to project folder, installed all requirements (PIL is changed to Pillow) and stacked with problem.
>>python manage.py syncdb
No local settings
Traceback (most recent call last):
File "manage.py", line 11, in <module>
execute_from_command_line(sys.argv)
File "/home/watashi/venv/lib/python2.7/site-packages/django/core/management/__init__.py", line 453, in execute_from_command_line
utility.execute()
File "/home/watashi/venv/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/watashi/venv/lib/python2.7/site-packages/django/core/management/__init__.py", line 272, in fetch_command
klass = load_command_class(app_name, subcommand)
File "/home/watashi/venv/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/watashi/venv/lib/python2.7/site-packages/django/utils/importlib.py", line 35, in import_module
__import__(name)
File "/home/watashi/venv/lib/python2.7/site-packages/south/management/commands/__init__.py", line 10, in <module>
import django.template.loaders.app_directories
File "/home/watashi/venv/lib/python2.7/site-packages/django/template/loaders/app_directories.py", line 25, in <module>
raise ImproperlyConfigured('ImportError %s: %s' % (app, e.args[0]))
django.core.exceptions.ImproperlyConfigured: ImportError utils: No module named Image
To solve this problem I also tried following by this tutorial, but it didn't help. What wrong with it? How to understand that problem?
Other information:
manage.py script
#!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "project.settings")
from django.core.management import execute_from_command_line
execute_from_command_line(sys.argv)
The issue can be fixed by using the following command
pip install --upgrade setuptools .

Django ImportError: Could not import settings

I am getting following error. Before git pull and merge, everything was working fine. I checked the history to find removal of any files etc.
I have checked here. I have checked other ans on stackoverflow but, it didn't solve the problem.
I have checked sys.path. Project directory path is present in sys.path.
Someone mentioned to verify __init__.py file in myapp folder. It is present.
Bootstrap3 package is installed in system.
I ran python setup.py develop again.
Not sure how to debug this?
$ python manage.py runserver
Traceback (most recent call last):
File "manage.py", line 10, in <module>
execute_from_command_line(sys.argv)
File "/usr/local/lib/python2.7/dist-packages/Django-1.5.4-py2.7.egg/django/core/management/__init__.py", line 453, in execute_from_command_line
utility.execute()
File "/usr/local/lib/python2.7/dist-packages/Django-1.5.4-py2.7.egg/django/core/management/__init__.py", line 392, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/usr/local/lib/python2.7/dist-packages/Django-1.5.4-py2.7.egg/django/core/management/__init__.py", line 263, in fetch_command
app_name = get_commands()[subcommand]
File "/usr/local/lib/python2.7/dist-packages/Django-1.5.4-py2.7.egg/django/core/management/__init__.py", line 109, in get_commands
apps = settings.INSTALLED_APPS
File "/usr/local/lib/python2.7/dist-packages/Django-1.5.4-py2.7.egg/django/conf/__init__.py", line 53, in __getattr__
self._setup(name)
File "/usr/local/lib/python2.7/dist-packages/Django-1.5.4-py2.7.egg/django/conf/__init__.py", line 48, in _setup
self._wrapped = Settings(settings_module)
File "/usr/local/lib/python2.7/dist-packages/Django-1.5.4-py2.7.egg/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 'myapp.settings' (Is it on sys.path?): No module named bootstrap3
You are using bootstrap3 and its might be not installed or not in PYTHONPATH.
Original error is No module named bootstrap3, please check for bootstrap3 module.
You have to install requirements.txt and it will be ok !
run this command in your shell:
pip install -r requirements.txt

Problem of setting up a python app

Hey guys
I'm new to Python, I want to install this python app called mirosubs on my VPS, and I followed the installation guide in this github pages, when I got to the step 8:
python manage.py syncdb
I got the following error:
root#makserver:/usr/local/src/mirosubs# python manage.py syncdb
Traceback (most recent call last):
File "manage.py", line 35, in <module>
execute_manager(settings)
File "/usr/local/lib/python2.6/dist-packages/Django-1.2.5-py2.6.egg/django/core/management/__init__.py", line 438, in execute_manager
utility.execute()
File "/usr/local/lib/python2.6/dist-packages/Django-1.2.5-py2.6.egg/django/core/management/__init__.py", line 379, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/usr/local/lib/python2.6/dist-packages/Django-1.2.5-py2.6.egg/django/core/management/__init__.py", line 261, in fetch_command
klass = load_command_class(app_name, subcommand)
File "/usr/local/lib/python2.6/dist-packages/Django-1.2.5-py2.6.egg/django/core/management/__init__.py", line 67, in load_command_class
module = import_module('%s.management.commands.%s' % (app_name, name))
File "/usr/local/lib/python2.6/dist-packages/Django-1.2.5-py2.6.egg/django/utils/importlib.py", line 35, in import_module
__import__(name)
File "/usr/local/lib/python2.6/dist-packages/South-0.7.3-py2.6.egg/south/management/commands/__init__.py", line 10, in <module>
import django.template.loaders.app_directories
File "/usr/local/lib/python2.6/dist-packages/Django-1.2.5-py2.6.egg/django/template/loaders/app_directories.py", line 23, in <module>
raise ImproperlyConfigured('ImportError %s: %s' % (app, e.args[0]))
django.core.exceptions.ImproperlyConfigured: ImportError haystack: cannot import name Thumbnail
Anybody can tell me how to solve this problem?
The module haystack is trying to import a type called Thumbnail but can't find it. Do a search through the source for Thumbnail and try to determine what's happening.

Categories