Forums

Flask-migrate not working

Hello Pythonanywhere team,

I don't get flask-migrate to work and I suspect there is something odd about the flask command. It work locally and I have installed the flask-migrate in the virtualenv. This is what happens. Please also feel free to look into my files.

20:17 /var/www/sites/polaris-apollo-production $ source venv-arm/bin/activate

(venv-arm) 20:17 /var/www/sites/polaris-apollo-production $ export FLASK_APP=run.py

(venv-arm) 20:18 /var/www/sites/polaris-apollo-production $ flask db init

Usage: flask [OPTIONS] COMMAND [ARGS]...

Try "flask --help" for help.

Error: No such command "db".

Looks like Flask is not recognizing the db command. How did you configure that in your code?

Configured it using flask-migrate. Flask does not seem to recognise anything from my virtualenv. It tries to load packages from python2.7....

Never mind, I doing the migrations directly in code now...

run which flask to see what flask are you getting

09:34 /var/www/sites/polaris-apollo-production $ source venv-arm/bin/activate

(venv-arm) 09:34 /var/www/sites/polaris-apollo-production $ which flask
/usr/local/bin/flask

(venv-arm) 09:35 /var/www/sites/polaris-apollo-production $ which python
/usr/bin/python

how was your venv created?

On my development machine using python -m venv venv-arm

You cannot generally copy virtualenvs between machines. If you want to use a virtualenv on PythonAnywhere, then create it on PythonAnywhere.