Q1.
I am running a local server. It was running without any issue. I ran pip install -r requirements.txt to make sure I have all the packages before running it again.
Now I keep getting the following error:
django.db.utils.ProgrammingError: relation "celery_taskmeta" does not exist
There is a related question on SO that's rather old and it suggests running manage.py migrate but running it also returns the same error.
Here is the contents of my requirements.txt:
amqp==1.4.6
anyjson==0.3.3
apns-clerk==0.1.1
arrow==0.4.1
backports.ssl-match-hostname==3.4.0.2
billiard==3.3.0.19
bootstrap-admin==0.3.0
boto==2.25.0
celery==3.1.17
certifi==14.5.14
cffi==0.8.6
cryptography==0.7.1
Cython==0.19.1
dill==0.2.1
Django==1.6.1
django-appconf==0.6
django-bower==4.8.1
django-celery==3.1.0
django-compressor==1.3
django-debug-toolbar==1.2
django-extensions==1.4.9
django-gravatar2==1.1.3
django-picklefield==0.3.1
django-resized==0.2.4
django-ses==0.6.0
djangorestframework==2.3.8
enum34==1.0.4
gcm-client==0.1.4
Jinja2==2.7.3
joblib==0.8.0a3
kombu==3.0.24
line-profiler==1.0b3
MarkupSafe==0.23
mlpy==3.5.0
mock==1.0.1
nose==1.3.4
numpy==1.8.0
Pillow==2.7.0
psycopg2==2.4.6
pyasn1==0.1.7
pycparser==2.10
pyOpenSSL==0.14
pyparsing==2.0.3
python-dateutil==2.2
python-memcached==1.48
python-slugify==0.1.0
pytz==2014.10
pyzmq==14.4.1
raven==3.3.7
requests==2.5.1
scipy==0.13.3
six==1.8.0
South==0.7.6
sqlparse==0.1.11
tornado==4.0.2
Unidecode==0.4.17
yattag==1.0.7
I'm not sure what to do to resolve this issue.
Is it an incompatibility between older and newer versions of Django and Celery? My latest install was two weeks old, so is there a release in the past two weeks that might be causing this? Or is it something completely unrelated?
Q2.
I'm a beginner so I'm not even sure what celery_taskmeta is and what is its significance.
The problem in this case was solved by running:
python manage.py syncdb --all
This question points to a mismatch in version between django and celery but reinstalling them didn't change anything. It seems it was an issue in older versions (here too)
Other sources point out that this might work:
python manage.py migrate djcelery
or
python manage.py syncdb
python manage.py migrate
But the --all option proved critical in solving this problem. This was the source that was most helpful.
I hope this is useful for anyone
Related
I am using elastic beanstalk to deploy my Django application. Today it suddenly stopped working without any breaking changes from the application side (I've changed some templates, nothing more).
The deployment time outs after 10 minutes of trying to deploy the app and nothing happens.
The only more or less useful hints I can see in the log is this:
[2020-02-20T15:00:20.437Z] INFO [19057] - [Application update .../postbuild_0_myproject/Command 01_migrate] : Activity execution failed, because: SystemCheckError: System check identified some issues:
ERRORS:
education.Author.photo: (fields.E210) Cannot use ImageField because Pillow is not installed.
HINT: Get Pillow at https://pypi.org/project/Pillow/ or run command "pip install Pillow".
education.Course.cover_image: (fields.E210) Cannot use ImageField because Pillow is not installed.
HINT: Get Pillow at https://pypi.org/project/Pillow/ or run command "pip install Pillow".
education.CourseCategory.icon_image: (fields.E210) Cannot use ImageField because Pillow is not installed.
HINT: Get Pillow at https://pypi.org/project/Pillow/ or run command "pip install Pillow".
Using staging settings
App receivers connected
(ElasticBeanstalk::ExternalInvocationError)
[2020-02-20T15:00:20.437Z] INFO [19057] - [Application update .../postbuild_0_myproject/Command 01_migrate] : Activity failed.
[2020-02-20T15:00:20.437Z] INFO [19057] - [Application update .../postbuild_0_myproject] : Activity failed.
[2020-02-20T15:00:20.437Z] INFO [19057] - [Application update ...] : Activity failed.
[2020-02-20T15:00:20.507Z] INFO [19057] - [Application update app-9a24-200220_145942-stage-200220_145942#142/AppDeployStage0/EbExtensionPostBuild] : Activity failed.
[2020-02-20T15:00:20.507Z] INFO [19057] - [Application update app-9a24-200220_145942-stage-200220_145942#142/AppDeployStage0] : Activity failed.
[2020-02-20T15:00:20.508Z] INFO [19057] - [Application update app-9a24-200220_145942-stage-200220_145942#142] : Completed activity. Result:
Application update - Command CMD-AppDeploy failed
But I already have Pillow in requirements.txt and the log above says:
Requirement already satisfied: Pillow==6.2.1 in /opt/python/run/venv/lib64/python3.6/site-packages (from -r /opt/python/ondeck/app/requirements.txt (line 51))
How can I troubleshoot and fix this? And how can I avoid similar issues in the future? I am really frightened that the same problem may randomly pop out on production environment.
Here's some more info about the configuration:
Here's what I have in .ebextensions:
01_packages.config:
packages:
yum:
git: []
postgresql93-devel: []
db-migrate.config
container_commands:
01_migrate:
command: "django-admin.py migrate"
leader_only: true
option_settings:
aws:elasticbeanstalk:application:environment:
DJANGO_SETTINGS_MODULE: myproject.settings
django.config
option_settings:
aws:elasticbeanstalk:container:python:
WSGIPath: myproject/wsgi.py
wsgi_custom.config
files:
"/etc/httpd/conf.d/wsgihacks.conf":
mode: "000644"
owner: root
group: root
content: |
WSGIPassAuthorization On
This one is a pain and a known issue with Django when using the ImageField model/form. Due to Pythons dynamic import system it will suddenly appear and annoyed the hell out of me when I first came across it.
The way I normally fix this is by using conda and its equivalent of a virtualenv to ensure the right interpreter (the one with my packages) is used.
If you are not using a virtualenv or equivalent, set one up now, if you are already using one then check you are installing pillow with pip3 install pillow - the pip3 being important here as on debian (and many other) systems normal pip will only install for python 2.x.
Using conda will ensure this doesnt happen in production, but I would also add it to your checklist of things to test when deploying - check correct version of pillow setup and working.
I had two Elastic Beanstalk environments with the same issue (one web tier env and a worker env).
On one of them the issue was resolved by restarting the environment.
The other one failed to restart and timed out every time on any operation. This one I managed to fix by going to configuration > capacity and changing the minimum and maximum number of instances to 0. I've applied the changes, waited for them to apply and then returned the previous values for min and max instance numbers.
That fixed the issue.
I still have no idea what caused the issue in the first place and would love to receive some comment on that.
I've installed the django-dbbackup package and from what the Documentation tells, i need to run python manage.py dbbackup
but it generated error pg_dump: error: too many command-line arguments
from what i have seen in the logs
dbbackup.db.exceptions.CommandConnectorError: Error running: pg_dump database_name --host=127.0.0.1 --port=5432 --username=postgres --no-password --clean
From what i have known, the correct command for pg_dump is to include the database name in the last part but the dbbackup include the database name first.
Anyone know the fix for the Django-dbbackup?
I had the same error. What I did was
Made sure pg_dump was in the environment variable in my system.
pip uninstall dbbackup
pip install django-dbbackup --upgrade
And it worked!
I have same issue with you, this is my env
Window 10
postgres10
django 2.2.9
django-dbbackup 3.2.0
I can manual run successfully like below, add "--dbname" parm name.
pg_dump --dbname=database_name --host=127.0.0.1 --port=5432 --username=postgres --no-password --clean
I don't know how to override the command by create a new method, so I changed the source code in dbbackup package directly, it works.
file "\Lib\site-packages\dbbackup\db\postgresql.py"
from:
cmd = '{} --dbname={}'.format(self.dump_cmd, self.settings['NAME'])
to:
cmd = '{} {}'.format(self.dump_cmd, self.settings['NAME'])
I'm trying to run the python heroku tutorial and it won't work in windows. This is from this repository.
I posted this previously but I was able to get a more descriptive error message. It should be said that I've installed postgres.
Furthermore, I can't run it locally using the method defined in the git respository. Both the createdb and foreman commands don't work. This is despite installing foreman.
django.core.exceptions.ImproperlyConfigured: 'django_postgrespool' isn't an available database backend.
Try using 'django.db.backends.XXX', where XXX is one of:
u'base', u'mysql', u'oracle', u'postgresql_psycopg2', u'sqlite3'
Error was: DLL load failed: The specified module could not be found.
Looks like python does not know what django-postgrespool is.
Perhaps it did not install properly. Check the output of pip install -r requirements.txt
DATABASES['default']['ENGINE'] = 'django_postgrespool'
in your settings.py is what this is referring to. For me i still dont know why this is causing a problem. I've install psycopg2 and I even tried installing 'pip install django-postgrespool'. It worked once i commented out:
DATABASES['default'] = dj_database_url.config()
DATABASES['default']['ENGINE'] = 'django_postgrespool'
this helps me run the app locally by using the
heroku local web -f Procfile.windows
I was following the same tutorial and what worked for me was changing the settings.py file, this line:
# Enable Connection Pooling (if desired)
DATABASES['default']['ENGINE'] = 'django_postgrespool'
To this:
# Enable Connection Pooling (if desired)
DATABASES['default']['ENGINE'] = 'django.db.backends.postgresql_psycopg2'
I'm trying to get django-cron to work on a winXP machine. (Wish I could use *nix).
Done
pip install django-cron
Added django_cron to INSTALLED_APPS in settings.py.
Then from windows console, ran below command
python manage.py syncdb
The result I got is:
"Not synced (use migrations):
`- django_cron`
(use ./manage.py migrate to migrate these)"
OK, So as per instructions from error msg I did, C:\ python manage.py migrate. Result is as follow:
Running migrations for django_cron:
- Nothing to migrate.
- Loading initial data for django_cron.
Installed 0 object(s) from 0 fixture(s)
Now what? What should I Google in order to figure out what's wrong with the migration?
Did I installed django-cron on the appropriate location?
Right now it's in
python27\Lib\site-packages\django_cron
I'm unable to make django-dilla work with my django1.4 project. I've installed django-dilla through pip and I can import it properly from shell.
>>import dilla
>>dilla.__file__
'/Users/misterte/.envs/python2.7-Django1.4/lib/python2.7/site-packages/django_dilla-0.2beta-py2.7.egg/dilla/__init__.py'
I've added it to my installed apps just before south, and ran my syncdb command.
INSTALLED_APPS = (
[...]
'dilla',
'south',
)
But when I try to call it, it won't work.
$python manage.py dilla --cycles=30
Unknown command: 'dilla'
Type 'manage.py help' for usage.
$python manage.py run_dilla --cycles=30
Unknown command: 'run_dilla'
Type 'manage.py help' for usage.
Then, of course, no sub commands are present under the [dilla] app when running help.
$python manage.py help | grep dilla
# emptiness :(
Any clues? Does dilla work in the django1.4 layout?
Thanks!
A.
So I found the problem.
For some reason pip is not installing dilla under site packages. I can import dilla and the egg is present under my site-packages folder, but further inspection showed that there were no packages under dilla.
Solution: copy dilla into you folder manually. I downloaded it from github.
Also, I recommend you copy it to a 'vendor' subfolder in your project. This way you avoid probably having to do the same hack in your production server. Then you import app as 'vendor.dilla' in your installed apps.
A.