I am trying to set a little report system up on the system to allow admin to produce reports as Csv documents.
I found Django-import-export installed it changed my INSTALLED_APPS, everything worked. If there was no module names import-export im guessing putting it into INSTALLED_APPS would have given me a error before this one so i dont understand why im getting this error.
Like the documnetation suggests i'm adding
from import_export import resources
Into admin.py but i get an error each time
Traceback (most recent call last):
File "/home/vagrant/env/local/lib/python2.7/site-packages/django/utils/autoreload.py", line 229, in wrapper
fn(*args, **kwargs)
File "/home/vagrant/env/local/lib/python2.7/site-packages/django/core/management/commands/runserver.py", line 107, in inner_run
autoreload.raise_last_exception()
File "/home/vagrant/env/local/lib/python2.7/site-packages/django/utils/autoreload.py", line 252, in raise_last_exception
six.reraise(*_exception)
File "/home/vagrant/env/local/lib/python2.7/site-packages/django/utils/autoreload.py", line 229, in wrapper
fn(*args, **kwargs)
File "/home/vagrant/env/local/lib/python2.7/site-packages/django/__init__.py", line 18, in setup
apps.populate(settings.INSTALLED_APPS)
File "/home/vagrant/env/local/lib/python2.7/site-packages/django/apps/registry.py", line 115, in populate
app_config.ready()
File "/home/vagrant/env/local/lib/python2.7/site-packages/django/contrib/admin/apps.py", line 22, in ready
self.module.autodiscover()
File "/home/vagrant/env/local/lib/python2.7/site-packages/django/contrib/admin/__init__.py", line 24, in autodiscover
autodiscover_modules('admin', register_to=site)
File "/home/vagrant/env/local/lib/python2.7/site-packages/django/utils/module_loading.py", line 74, in autodiscover_modules
import_module('%s.%s' % (app_config.name, module_to_search))
File "/usr/lib/python2.7/importlib/__init__.py", line 37, in import_module
__import__(name)
File "/vagrant/twm/component/admin.py", line 11, in <module>
from import_export import *
ImportError: No module named import_export**strong text**
Can anyone help me get this working?
As commented, installing packages is not a good idea in my opinion.
You might consider using virtualenv within your vagrant. This most likely will solve your issues.
1) Write your current requirements to a file
When using the virtualenv, we probably want the same packages which you
have now. Write the current requirements to a file called requirements.txt by typing pip freeze > requirements.txt (in your project root)
2) Edit your Vagrantfile
Open your Vagrantfile and after
config.vm.box = "<yourbox>"
add
config.vm.provision :shell, path: "install.sh"
We will create install.sh on the next step. This install script will be executed every time you perform the vagrant up command.
3) Create your install.sh file
echo "--- Installing Virtual env ---"
mkdir /virtualenv &>/dev/null
virtualenv /virtualenv &>/dev/null
source /virtualenv/bin/activate &>/dev/null
chown vagrant:vagrant /virtualenv -R &>/dev/null
echo "--- Installing PIP ---"
wget https://bootstrap.pypa.io/get-pip.py &>/dev/null
python get-pip.py &>/dev/null
rm get-pip.py &>/dev/null
echo "--- Installing Django dependencies ---"
pip install -r requirements.txt &>/dev/null
4) destroy and up your vagrant
Destroying the current vagrant will make you lose any adjustments you made in your vagrant (not in your files). You can add any adjustments to your install.sh so it will be configured on vagrant up. If you are sure you are ready to destroy your vagrant, type vagrant destroy followed by vagrant up
When you upped your vagrant, you will see (virtualenv) in front of your prompt. Package loading and installing will now be done in the virtualenv.
Related
I have an old DJango application that used work fine but suddenly crashes. I use to test it with:
cd /opt/formshare/src/formshare/
export PYTHONPATH=$PYTHONPATH:/opt/formshare/src/formshare
export DJANGO_SETTINGS_MODULE=formshare.settings.default_settings
python manage.py validate
But now I get this error:
(formshare) bash-4.3$ python manage.py validate
Your environment is:"formshare.settings.default_settings"
Traceback (most recent call last):
File "manage.py", line 21, in <module>
execute_from_command_line(sys.argv)
File "/opt/formshare/lib/python2.7/site-packages/django/core/management/__init__.py", line 399, in execute_from_command_line
utility.execute()
File "/opt/formshare/lib/python2.7/site-packages/django/core/management/__init__.py", line 392, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/opt/formshare/lib/python2.7/site-packages/django/core/management/__init__.py", line 261, in fetch_command
commands = get_commands()
File "/opt/formshare/lib/python2.7/site-packages/django/core/management/__init__.py", line 107, in get_commands
apps = settings.INSTALLED_APPS
File "/opt/formshare/lib/python2.7/site-packages/django/conf/__init__.py", line 54, in __getattr__
self._setup(name)
File "/opt/formshare/lib/python2.7/site-packages/django/conf/__init__.py", line 49, in _setup
self._wrapped = Settings(settings_module)
File "/opt/formshare/lib/python2.7/site-packages/django/conf/__init__.py", line 132, in __init__
% (self.SETTINGS_MODULE, e)
ImportError: Could not import settings 'formshare.settings.default_settings' (Is it on sys.path? Is there an import error in the settings file?): cannot import name OrderedDict
I am using:
virtualenv=15.0.2
Python=2.7.11
amqp==2.1.1
billiard==3.3.0.23
celery==3.1.15
dict2xml==1.3
Django==1.6.11
django-braces==1.10.0
django-celery==3.1.16
django-cors-headers==0.13
django-db-readonly==0.3.2
django-digest==1.13
django-filter==0.7
django-guardian==1.2.4
django-nose==1.4.2
django-oauth-toolkit==0.7.2
django-registration-redux==1.1
django-reversion==1.8.4
django-taggit==0.12.1
django-templated-email==0.4.9
djangorestframework==2.4.3
djangorestframework-csv==1.3.3
dpath==1.2.post70
elaphe==0.5.6
FormEncode==1.3.1
gdata==2.0.18
httmock==1.2.2
httplib2==0.9
jdcal==1.3
jsonfield==0.9.23
kombu==4.0.0
librabbitmq==1.5.2
linecache2==1.0.0
lxml==3.4.0
Markdown==2.5
mock==1.0.1
modilabs-python-utils==0.1.5
nose==1.3.7
numpy==1.11.2
oauthlib==2.0.1
openpyxl==2.0.5
pandas==0.12.0
Pillow==2.5.3
poster==0.8.1
psycopg2==2.5.4
pybamboo==0.5.8.1
pylibmc==1.3.0
pymongo==2.7.2
python-dateutil==2.6.0
python-digest==1.7
-e git+https://github.com/qlands/python-json2xlsclient.git#5a39387752d819cb6387f75569dbea9a5288aa6f#egg=python_json2xlsclient
pytz==2014.7
-e git+https://github.com/XLSForm/pyxform.git#cfe8589f40319fa3279b0a83e0d23d49bcbe8408#egg=pyxform
recaptcha-client==1.0.6
requests==2.4.1
savReaderWriter==3.4.2
simplejson==2.6.2
six==1.10.0
South==1.0
traceback2==1.4.0
unicodecsv==0.9.4
unittest2==1.1.0
vine==1.1.3
xlrd==0.9.3
xlwt==0.7.5
I tried to add set the path and setting in the validate but nothing works.
Any idea what could have changed and how to correct it?
The django process doesn't appear to be seeing your formshare.settings.default_settings. Without seeing the project structure, it's hard to know exactly what's going on, but a few things you might check.
If you are using python 2.x, does the formshare/ and the settings/ directory both have an __init__.py file in them?
Try adding /opt/formshare/src/ to the python path instead of (or in addition to) what you have.
One trick that I often try to make sure the python path is correct: while I'm active in my virtualenv, I'll enter a python shell (not django shell) and try something like the following:
import formshare
from formshare import settings
from fomrmshare.settings import default_settings
The error messages that might be generated from those might also help isolate the issue.
Since you activated virtualenv, you have to do something different. Try add2virtualenv in virtualenvwrapper.For more info
http://virtualenvwrapper.readthedocs.io/en/latest/command_ref.html#add2virtualenv
Django CMS 3.4.1
Django 1.10.2
pip modules: http://pastebin.com/vJWvZVfA
pip 8.1.2
Python 2.7.12
OS: Amazon Linux AMI release 2016.03
I'm new to Django CMS, Django, and Python. My previous CMS experience has been with WordPress and I'm try to try out Django CMS as an alternative to WordPress, but am getting an error that I can not seem to figure out. I have updated the pip modules and installed others as suggested in threads on StackOverflow, but to no avail.
I followed the tutorial the instructions, with the exception of the djangocms command, which is incorrect in the tutorial. (It's missing the -w flag.)
EDIT: As requested, here is the output with the --verbose flag added:
(env)[ec2-user#(redacted) tutorial-project]$ djangocms -d postgres://(redacted) -e no --permissions yes -l "en-CA, en-US, en, fr-CA, fr-FR" -p . --starting-page yes --verbose --utc mysite
Creating the project
Please wait while I install dependencies
Package install command: install django-cms<3.5 djangocms-admin-style>=1.2,<1.3 django-treebeard>=4.0,<5.0 psycopg2 djangocms-text-ckeditor>=3.2.1 djangocms-link>=1.8 djangocms-style>=1.7 djangocms-googlemap>=0.5 djangocms-snippet>=1.9 djangocms-video>=2.0 djangocms-column>=1.6 easy_thumbnails django-filer>=1.2 cmsplugin-filer>=1.1 Django<1.9 pytz django-classy-tags>=0.7 html5lib>=0.999999,<0.99999999 Pillow>=3.0 django-sekizai>=0.9 django-select2<5.0six
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-duWZSN/psycopg2/
The installation has failed.
*****************************************************************
Check documentation at https://djangocms-installer.readthedocs.io
*****************************************************************
Traceback (most recent call last):
File "/home/ec2-user/env/bin/djangocms", line 11, in <module>
sys.exit(execute())
File "/home/ec2-user/env/local/lib/python2.7/site-packages/djangocms_installer/main.py", line 33, in execute
verbose=config_data.verbose
File "/home/ec2-user/env/local/lib/python2.7/site-packages/djangocms_installer/install/__init__.py", line 91, in requirements
output = subprocess.check_output(['pip'] + args)
File "/usr/lib64/python2.7/subprocess.py", line 574, in check_output
raise CalledProcessError(retcode, cmd, output=output)
subprocess.CalledProcessError: Command '[u'pip', u'install', u'django-cms<3.5', u'djangocms-admin-style>=1.2,<1.3', u'django-treebeard>=4.0,<5.0', u'psycopg2', u'djangocms-text-ckeditor>=3.2.1', u'djangocms-link>=1.8', u'djangocms-style>=1.7', u'djangocms-googlemap>=0.5', u'djangocms-snippet>=1.9', u'djangocms-video>=2.0', u'djangocms-column>=1.6', u'easy_thumbnails', u'django-filer>=1.2', u'cmsplugin-filer>=1.1', u'Django<1.9', u'pytz', u'django-classy-tags>=0.7', u'html5lib>=0.999999,<0.99999999', u'Pillow>=3.0', u'django-sekizai>=0.9', u'django-select2<5.0six']' returned non-zero exit status 1
EDIT 2: (moved to answer)
EDIT 3:
After solving the first part, another error remains. I'll include it in this post since it still falls under the topic of the title:
Creating the project
Project creation command: /home/ec2-user/env/bin/python2.7 /home/ec2-user/env/bin/django-admin.py startproject mysite /home/ec2-user/tutorial-project
Database setup commands: /home/ec2-user/env/bin/python2.7 -W ignore manage.py migrate
Traceback (most recent call last):
File "manage.py", line 10, in <module>
execute_from_command_line(sys.argv)
File "/home/ec2-user/env/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 354, in execute_from_command_line
utility.execute()
File "/home/ec2-user/env/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 346, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/home/ec2-user/env/local/lib/python2.7/site-packages/django/core/management/base.py", line 394, in run_from_argv
self.execute(*args, **cmd_options)
File "/home/ec2-user/env/local/lib/python2.7/site-packages/django/core/management/base.py", line 445, in execute
output = self.handle(*args, **options)
File "/home/ec2-user/env/local/lib/python2.7/site-packages/django/core/management/commands/migrate.py", line 93, in handle
executor = MigrationExecutor(connection, self.migration_progress_callback)
File "/home/ec2-user/env/local/lib/python2.7/site-packages/django/db/migrations/executor.py", line 19, in __init__
self.loader = MigrationLoader(self.connection)
File "/home/ec2-user/env/local/lib/python2.7/site-packages/django/db/migrations/loader.py", line 47, in __init__
self.build_graph()
File "/home/ec2-user/env/local/lib/python2.7/site-packages/django/db/migrations/loader.py", line 191, in build_graph
self.applied_migrations = recorder.applied_migrations()
File "/home/ec2-user/env/local/lib/python2.7/site-packages/django/db/migrations/recorder.py", line 59, in applied_migrations
self.ensure_schema()
File "/home/ec2-user/env/local/lib/python2.7/site-packages/django/db/migrations/recorder.py", line 49, in ensure_schema
if self.Migration._meta.db_table in self.connection.introspection.table_names(self.connection.cursor()):
File "/home/ec2-user/env/local/lib/python2.7/site-packages/django/db/backends/base/base.py", line 162, in cursor
cursor = self.make_debug_cursor(self._cursor())
File "/home/ec2-user/env/local/lib/python2.7/site-packages/django/db/backends/base/base.py", line 135, in _cursor
self.ensure_connection()
File "/home/ec2-user/env/local/lib/python2.7/site-packages/django/db/backends/base/base.py", line 130, in ensure_connection
self.connect()
File "/home/ec2-user/env/local/lib/python2.7/site-packages/django/db/backends/base/base.py", line 118, in connect
conn_params = self.get_connection_params()
File "/home/ec2-user/env/local/lib/python2.7/site-packages/django/db/backends/postgresql_psycopg2/base.py", line 158, in get_connection_params
"settings.DATABASES is improperly configured. "
django.core.exceptions.ImproperlyConfigured: settings.DATABASES is improperly configured. Please supply the NAME value.
The installation has failed.
*****************************************************************
Check documentation at https://djangocms-installer.readthedocs.io
*****************************************************************
Traceback (most recent call last):
File "/home/ec2-user/env/bin/djangocms", line 11, in <module>
sys.exit(execute())
File "/home/ec2-user/env/local/lib/python2.7/site-packages/djangocms_installer/main.py", line 41, in execute
django.setup_database(config_data)
File "/home/ec2-user/env/local/lib/python2.7/site-packages/djangocms_installer/django/__init__.py", line 388, in setup_database
output = subprocess.check_output(command, env=env)
File "/usr/lib64/python2.7/subprocess.py", line 574, in check_output
raise CalledProcessError(retcode, cmd, output=output)
subprocess.CalledProcessError: Command '['/home/ec2-user/env/bin/python2.7', u'-W', u'ignore', u'manage.py', u'migrate']' returned non-zero exit status 1
I'm going to guess that the problem lies in the message:
settings.DATABASES is improperly configured. Please supply the NAME value.
The installation has failed.
I'm using PostgreSQL, so I assume that the error is caused by the schema not being provided in the command argument. There was nothing in the guide that I saw indicating how to provide it, so I'll have to search some more.
The error message tells me absolutely nothing. It only tells me that Django tried to use pip to install something and for whatever reason it failed. In order to figure out what went wrong, try enabling verbose mode (python -v). If that gives the same output, or that isn't an option because you're using a program that calls Python (which it sounds like you are), let me know and prepare to go into the source code. Trust me, I have taken many a dive into source code for Python utilities, and as long as you don't do anything stupid (like delete a file) it's pretty hard to mess anything up. Even if you do you can always reinstall Django (or make a backup first). Don't worry about messing up your computer. You'd have to work hard to make Django do that!
Original error
The non-verbose error message indicates the error in a cryptic way, and using --verbose provides a more understandable message.
I was missing one required module (psycopg2) and four others were versions which were too new (easy_thumbnails, Django, html5lib, django-select2).
I uninstalled the four modules and then reinstalled them using the version requirement in the command. e.g. pip install 'Django<1.10'.
psycopg2 required extra steps, as I got an error message when trying to install it indicating that it could not find pg_config. Another SO answer advised that I just had to install postgresql-devel. After I did that, (sudo yum install postgresql-devel), I also uninstalled postgresql8-libs, as postgresql-devel came with a newer version. I didn't do it before since yum indicated a PHP dependency, and I wasn't sure if it would cause problems if I did.
Second error
Pretty simple. I was missing the /NAME component of the database URL (postgres://USER:PASSWORD#HOST:PORT/NAME).
I have been trying to deploy a python script to Iron.io. They recommend using docker to test locally before uploading.
I have completed their provided docker/iron tutorial without error.
So I started to modify the provided requirements.txt from their sample repo to start my own project, but whenever I try to install the packages locally I receive a TypeError.
My pip is version:
pip 7.1.2 from /Library/Python/2.7/site-packages (python 2.7)
Their requirements.txt
iron-mq>=0.5
iron-worker>=1.3.1
My requirements.txt
iron-mq>=0.5
iron-worker>=1.3.1
beautifulsoup4
html5lib
Terminal command:
$ docker run --rm -v "$PWD":/worker -w /worker iron/python:2-dev pip install -t packages -r requirements.txt
Error:
Exception:
Traceback (most recent call last):
File "/usr/lib/python2.7/site-packages/pip/basecommand.py", line 211, in main
status = self.run(options, args)
File "/usr/lib/python2.7/site-packages/pip/commands/install.py", line 282, in run
wheel_cache
File "/usr/lib/python2.7/site-packages/pip/basecommand.py", line 291, in populate_requirement_set
wheel_cache=wheel_cache):
File "/usr/lib/python2.7/site-packages/pip/req/req_file.py", line 89, in parse_requirements
for req in req_iter:
File "/usr/lib/python2.7/site-packages/pip/req/req_file.py", line 137, in process_line
isolated=isolated, options=req_options, wheel_cache=wheel_cache
File "/usr/lib/python2.7/site-packages/pip/req/req_install.py", line 168, in from_line
if (os.path.isdir(p) and
File "/usr/lib/python2.7/genericpath.py", line 49, in isdir
st = os.stat(s)
TypeError: must be encoded string without NULL bytes, not str
I am using Sublime on OSX and encoding with UTF-8. Other threads regarding this error are usually resolved by escaping some characters or changing the encoding. But I couldn't find an alternative encoding to use.
Is there a trick to saving requirements without any null bytes? Or is there another known fix?
Edit update:
Running with -vvv max verbose mode for pip
docker run --rm -v "$PWD":/worker -w /worker iron/python:2-dev pip install -vvv -t packages -r requirements.txt
Returned
Traceback (most recent call last):
File "/usr/lib/python2.7/site-packages/pip/basecommand.py", line 211, in main
status = self.run(options, args)
File "/usr/lib/python2.7/site-packages/pip/commands/install.py", line 282, in run
wheel_cache
File "/usr/lib/python2.7/site-packages/pip/basecommand.py", line 291, in populate_requirement_set
wheel_cache=wheel_cache):
File "/usr/lib/python2.7/site-packages/pip/req/req_file.py", line 89, in parse_requirements
for req in req_iter:
File "/usr/lib/python2.7/site-packages/pip/req/req_file.py", line 137, in process_line
isolated=isolated, options=req_options, wheel_cache=wheel_cache
File "/usr/lib/python2.7/site-packages/pip/req/req_install.py", line 168, in from_line
if (os.path.isdir(p) and
File "/usr/lib/python2.7/genericpath.py", line 49, in isdir
st = os.stat(s)
TypeError: must be encoded string without NULL bytes, not str
Starting new HTTPS connection (1): pypi.python.org
"GET /pypi/pip/json HTTP/1.1" 200 50975
The only new output was the two lines at the bottom.
Running iconv to identify any rogue characters just returns the contents of the txt file.
iconv -t UTF-8 requirements.txt
iron-mq>=0.5
iron-worker>=1.3.1
beautifulsoup4==4.4.1
I had the same trouble trying to run pip install on my Mac with the Iron docker images. After trying a bunch of things to fix it, I tracked the problem down to Docker Toolbox and vboxfs. They weren't syncing host filesystem changes properly. To fix it, in the docker toolbox VM I ran:
sync; echo 3 > /proc/sys/vm/drop_caches
The sync call syncs any pending writes to disk. The second command tells the kernel to clear the filesystem caches.
Once I did that my pip install worked fine.
On Windows and Mac OS, Docker Daemon runs on a virtual machine.
Try to enter the virtual machine and run the Docker commands there. A possible work around for this issue is to avoid running Docker commands on host machine.
As a reminder, Iron.io's support is available via phone, email or chat for additional questions.
Installing CKAN locally on OSX 10.9, based on http://docs.ckan.org/en/latest/maintaining/installing/install-from-source.html.
I've created and activated the python virtualenv and now need to create a CKAN config file:
$ paster make-config ckan /etc/ckan/default/development.ini
The output is as follows (ImportError at the last line):
Distribution already installed:
ckan 2.2 from ~/ckan/lib/default/src/ckan
Traceback (most recent call last):
File "/usr/lib/ckan/default/bin/paster", line 9, in <module>
load_entry_point('PasteScript==1.7.5', 'console_scripts', 'paster')()
File "/usr/lib/ckan/default/lib/python2.7/site-packages/paste/script/command.py", line 104, in run
invoke(command, command_name, options, args[1:])
File "/usr/lib/ckan/default/lib/python2.7/site-packages/paste/script/command.py", line 143, in invoke
exit_code = runner.run(args)
File "/usr/lib/ckan/default/lib/python2.7/site-packages/paste/script/appinstall.py", line 68, in run
return super(AbstractInstallCommand, self).run(new_args)
File "/usr/lib/ckan/default/lib/python2.7/site-packages/paste/script/command.py", line 238, in run
result = self.command()
File "/usr/lib/ckan/default/lib/python2.7/site-packages/paste/script/appinstall.py", line 295, in command
self.distro, self.options.ep_group, self.options.ep_name)
File "/usr/lib/ckan/default/lib/python2.7/site-packages/paste/script/appinstall.py", line 234, in get_installer
'paste.app_install', ep_name)
File "/usr/lib/ckan/default/lib/python2.7/site-packages/pkg_resources.py", line 2302, in load_entry_point
return ep.load()
File "/usr/lib/ckan/default/lib/python2.7/site-packages/pkg_resources.py", line 2029, in load
entry = __import__(self.module_name, globals(),globals(), ['__name__'])
File "~/ckan/lib/default/src/ckan/ckan/config/install.py", line 3, in <module>
from pylons.util import PylonsInstaller
ImportError: No module named pylons.util
I'm not sure how to proceed, any ideas?
ImportError: No module named pylons.util looks like Python cannot find the Pylons package, one of the Python packages that CKAN depends on. Two possibilities come to mind:
Did you activate your CKAN virtualenv, before running the paster command? ~/ckan/default/bin/activate.
Have you installed the Python packages that CKAN depends on into your virtualenv? With the virtualenv activated run pip install -r ~/ckan/default/src/ckan/requirements.txt
If you activate your CKAN virtual environment and then run pip freeze | grep pylons, this should tell you whether pylons is installed in the virtualenv.
The Distribution already installed: at the top of your terminal output is strange.
I had the same error and a slightly different solution:
got the error only after using sudo, so I went out of it (sudo -k)
then I got the following error: IOError: [Errno 13] Permission denied: '/etc/ckan/default/development.ini'
after digging around a lot, I finally found out that while the /etc/ckan had correct permissions, it was actually a symlink to ~/ckan/etc and that folder did not have correct permissions
I ran sudo chown -R `whoami` ~/ckan/etc and followed up with paster make-config ckan /etc/ckan/default/development.ini
I'm trying to use a django application on Github called django-audiofield in my django project. I'm using Aptana Studio IDE. I installed it in my virtual environment and I'm getting the following error:
Traceback (most recent call last):
File "/Users/home/Desktop/Web Development/Aptana Studio 3.0/musicproject/src/manage.py", line 10, in <module>
execute_from_command_line(sys.argv)
File "/Users/home/virtualenv/venv/lib/python2.7/site-packages/django/core/management/__init__.py", line 443, in execute_from_command_line
utility.execute()
File "/Users/home/virtualenv/venv/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/home/virtualenv/venv/lib/python2.7/site-packages/django/core/management/base.py", line 196, in run_from_argv
self.execute(*args, **options.__dict__)
File "/Users/home/virtualenv/venv/lib/python2.7/site-packages/django/core/management/base.py", line 232, in execute
output = self.handle(*args, **options)
File "/Users/home/virtualenv/venv/lib/python2.7/site-packages/django/core/management/base.py", line 371, in handle
return self.handle_noargs(**options)
File "/Users/home/virtualenv/venv/lib/python2.7/site-packages/django/core/management/commands/validate.py", line 9, in handle_noargs
self.validate(display_num_errors=True)
File "/Users/home/virtualenv/venv/lib/python2.7/site-packages/django/core/management/base.py", line 266, in validate
num_errors = get_validation_errors(s, app)
File "/Users/home/virtualenv/venv/lib/python2.7/site-packages/django/core/management/validation.py", line 30, in get_validation_errors
for (app_name, error) in get_app_errors().items():
File "/Users/home/virtualenv/venv/lib/python2.7/site-packages/django/db/models/loading.py", line 158, in get_app_errors
self._populate()
File "/Users/home/virtualenv/venv/lib/python2.7/site-packages/django/db/models/loading.py", line 67, in _populate
self.load_app(app_name)
File "/Users/home/virtualenv/venv/lib/python2.7/site-packages/django/db/models/loading.py", line 88, in load_app
models = import_module('.models', app_name)
File "/Users/home/virtualenv/venv/lib/python2.7/site-packages/django/utils/importlib.py", line 35, in import_module
__import__(name)
File "/Users/home/virtualenv/venv/src/audiofield/audiofield/models.py", line 19, in <module>
from audiofield.fields import AudioField
File "/Users/home/virtualenv/venv/src/audiofield/audiofield/fields.py", line 20, in <module>
from tasks import audio_convert_task
File "/Users/home/virtualenv/venv/src/audiofield/audiofield/tasks.py", line 14, in <module>
from celery.task import Task
ImportError: No module named celery.task
Finished "/Users/home/Desktop/Web Development/Aptana Studio 3.0/musicproject/src/manage.py validate" execution.
Please assist.
I'm the maintainer of the package, thanks to your post I realized that we were missing celery/django-celery in our requirements. It's now added in the latest version.
So "pip install django-audiofield" will install those dependencies for you.
If you have django-audiofield already installed you can run the following command to upgrade : "pip install django-audiofield --upgrade"
Have you installed celery? If no, install celery (pip install celery). If the github application in question (a link would have been nice) has a requirements.txt file anywhere, do pip install -r requirements.txt to install all the required dependencies of the application.
If yes, it looks like your import search path may not be set up correctly to find Celery - just a guess based on the import error.
Open up the django shell (type python manage.py shell when you're in your project's working directory) and type in import sys; print sys.path. Make sure that Celery is installed in one of those directories, since sys.path specifies the import search path for python modules.
If it isn't included there, you can temporarily append the directory celery is installed into by doing sys.path.append("<directory where celery is>") (mind the backslashes, since you're on Windows). If, after doing that, you can successfully from celery.tasks import Task, then you can set the PYTHONPATH environment variable appropriately to make it permanent.
Also, since you installed Celery into a virtualenv, it may be worth checking that both django and Celery are in the same virtualenv.
Finally, the latest commits to Celery indicate Celery now has native Django support, but since that hasn't been released as a stable version yet, you may want to look at django-celery.
Edit (in response to comment below):
Since you mentioned you're trying to get django-audiofield to work: it seems to be on pypi. This means you can use pip (or easy_install) to install it using pip install django-audiofield once you've installed all the required (non-python) dependencies, and stuff like celery should be downloaded for you.