We are using Flask with SQLAlchemy and Flask migrate. This was working fine so far but lately it has stopped showing error messages on failures. It just silently fails. I believe this started happening when we upgraded flask-migrate but I'm not 100% sure.
The issue is not that it's failing, it only fails when there's a proper reason (multiple head versions, or invalid migration file), but it does not report the error on console.
> flask db upgrade
INFO [alembic.runtime.migration] Context impl PostgresqlImpl.
INFO [alembic.runtime.migration] Will assume transactional DDL.
> echo $?
1
It works fine and applies migration when there's no failure:
> flask db upgrade
INFO [alembic.runtime.migration] Context impl PostgresqlImpl.
INFO [alembic.runtime.migration] Will assume transactional DDL.
INFO [alembic.runtime.migration] Running upgrade 34f504777ec2 -> ed96adbb2dd6, empty message
> echo $?
0
Versions:
> flask --version
Python 3.9.15
Flask 1.1.2
Werkzeug 1.0.1
Flask-Migrate = "^2.5.3"
Not sure why the error messages are not showing up.
This is due to an old bug, it's not a problem with your application.
The most important thing you need to do is to update the alembic.ini file that is in your migrations directory. You can take the updated version from the GitHub repo.
I think with the above all errors will be printed to the console.
In addition, you may consider upgrading Flask-Migrate to a more recent release, since the version that you are using is about 2.5 years old.
Related
I have read this stackoverflow Q&A but it did not worked it my case.
In my scenario I push a function (submit_transaction_for_settlement(transaction_id)) to the redis queue using the excellent package django-rq. The job of this function is to submit a transaction for settlement.
In the sandbox, whenever this function is executed I keep getting the same error: AttributeError: type object 'Configuration' has no attribute 'environment'.
I tried agf's proposal about instantiate a new gateway for each transaction inside my function, but it did not work!
Maybe this has something to do with the environment of the redis queue or the worker environment?
def submit_transaction_for_settlement(transaction_id):
from braintree import Configuration, BraintreeGateway
config = Configuration(environment=settings.BRAINTREE_ENVIRONMENT, merchant_id=settings.BRAINTREE_MERCHANT_ID,
public_key=settings.BRAINTREE_PUBLIC_KEY, private_key=settings.BRAINTREE_PRIVATE_KEY)
gateway = BraintreeGateway(config=config)
result = gateway.transaction.submit_for_settlement(transaction_id)
Ahrg!
I hate the moments where I answer a question and minutes after I find myself the solution!
The fault was in the command running the rqworker. I was using the command python manage.py rqworker --worker-class rq.SimpleWorker because I had this issue because I used python 2.7 (or something else caused this issue). The command generated this issue was python manage.py rqworker.
Upgrading now to python 3.4, the last command works like a charm!
So, running python manage.py rqworker did the trick and no such errors!
I have a problem with starting graphite web interface, using apache2. I get 500 Internal error, the screenshot of my log is below. I am new to this website and also to this software. My question might be too simple but, I have spent a lot of time on this. Thanks..
error log:
It looks like the database has not yet been created. You can do so by running:
sudo -u _graphite graphite-manage syncdb --noinput
and that should clear up the 500 error. This is a minimum to get started with Graphite, using the SQLite database. It is possible to configure an alternate database in the local_settings.py file, in which case the above command is not necessary. But with the default configuration, which uses SQLite as the back-end, this command should get you past the error.
Source: https://ianunruh.com/2014/05/monitor-everything-part-4.html
I've got some problems implementing 3rd party django package django-html5-appcache.
Documentation especify that migrate command must be executed, but when i execute command:
python manage.py migrate html5_appcache
Outputs:
"No migrations to apply"
However I decided to complete installation steps. but testing it maniffest file appears to be empty (according to docs, urls suppose to autodiscover):
CACHE MANIFEST
# version: $0$
# date: $-$
NETWORK:
*
And Chrome Console Outputs:
Creating Application Cache with manifest http://127.0.0.1:8000/manifest.appcache
127.0.0.1/:1 Application Cache Checking event
127.0.0.1/:1 Application Cache Downloading event
127.0.0.1/:1 Application Cache Progress event (0 of 0)
127.0.0.1/:1 Application Cache Cached event
Im using Django 1.7
Any body has expirience with this django package?
I suspect that you're supposed to put the following code in your urls.py to get autodiscover.
Enable appcache discovery by adding the lines below in urls.py:
import html5_appcache
html5_appcache.autodiscover()
(Source: documentation here: https://django-html5-appcache.readthedocs.org/en/latest/installation.html)
Also, python manage.py migrate commands are used to alter the DB structure and should not affect your urls.py.
I have no idea why celery suddenly stopped working, probably missing some settings but I don't think so .... and code of views that runs celery tasks is the same, sentry only shows as follows:
It works locally (develop env) but in production it doesn't, I'm using django 1.4.2, djcelery 3.0.11 and celery 3.1.9, what do you think happening?
I've run into the same problem, but but part of an upgrade (among others):
Django >=1.5,<1.6 -> >=1.6,<1.7
celery <3.1 -> >=3.1.17
django-celery <3.1 -> <=3.1.16
I can see you opened an issue on Celery's Github project. However, The request keyword argument was added to celery a long time ago, and it seems to be still present in the master branch.
This is the logic in a base back-end class, but if the implementation you're using doesn't have this keyword argument, it'll crash. In your case, it looks like the versions of celery and django-celery are incompatible.
The commit to bring support to 3.1 is only available in following versions of django-celery: v3.1.16 v3.1.15 v3.1.10 v3.1.9 v3.1.1 v3.1.0, I suggest upgrading to one of these.
i purchased an outsource service to develop a web site in django to be deployed in heroku and AWS S3 (boto package).
Unfortunately the developer did not comment the code, despite it was asked, and left the project uncompleted for following up with a bigger client.
I've hired another django 'expert' to fix a part which was not developed, and he want to (over)charge for deployment testing, which i think should be a normal matter for good practices! i am working on my own budject, and need to work it out myself.
I was able to make the project run locally and make myself the frontend templates which were not fully developed, but I am having issues in deploying the code on my own staging environment.
I set up a staging environment under my credential to check if everything is ok, before pushing to production.
I think I almost get there, though:
heroku run python manage.py migrate --all --noinput --app my-app-staging
generate in the console:
Running `python manage.py migrate --all --noinput` attached to terminal... up, run.4833
DatabaseError: relation "south_migrationhistory" does not exist
LINE 1: ...gration", "south_migrationhistory"."applied" FROM "south_mig...
In the browser:
DatabaseError at /
relation "django_site" does not exist
LINE 1: ..."django_site"."domain", "django_site"."name" FROM "django_si...
^
Request Method: GET
Request URL: http://my-app-staging.herokuapp.com/
Django Version: 1.5.6
Exception Type: DatabaseError
Exception Value:
relation "django_site" does not exist
LINE 1: ..."django_site"."domain", "django_site"."name" FROM "django_si...
^
Exception Location: /app/.heroku/python/lib/python2.7/site-packages/django/db/backends/postgresql_psycopg2/base.py in execute, line 5
I checked my settings and they look ok:
i check AWS S3 bucket and it is able to write there;
settings in heroku console display that the db has been created.
I followed:
Heroku created table but when I'll migrate, he says that doesn't created
but it looks my locals.py are ok too, and in my local git branch .gitignore will exclude db.sqlite
My git and heroku ssh keys have been generated and added, so i dont' think it is an issue of authentification.
How could i check that the db is properly connected to django project and I am not invalidated?
Could you please help in debriefing to understand what this error means and how to solve it?
So much thank you.
It sounds like you might not have created the initial South migration tables on your staging server. This is actually done using syncdb:
Once South is added in, you’ll need to run ./manage.py syncdb to make the South migration-tracking tables (South doesn’t use migrations for its own models, for various reasons).
To run this on Heroku, you'll probably want to use something like
heroku run python manage.py syncdb
Once this is done, you should be able to move forward with the South commands.