Reputation: 2120
#!flask/bin/python
from migrate.versioning import api
from config import SQLALCHEMY_DATABASE_URI
from config import SQLALCHEMY_MIGRATE_REPO
from app import db
import os.path
db.create_all()
if not os.path.exists(SQLALCHEMY_MIGRATE_REPO):
api.create(SQLALCHEMY_MIGRATE_REPO, 'database repository')
api.version_control(SQLALCHEMY_DATABASE_URI, SQLALCHEMY_MIGRATE_REPO)
else:
api.version_control(SQLALCHEMY_DATABASE_URI, SQLALCHEMY_MIGRATE_REPO, api.version(SQLALCHEMY_MIGRATE_REPO))
I use following command
chmod a+x db_create.py
./db_create.py
but this gives me the error. Does the comment on first line affect running script. I have this file in this directory /home/Name/FlaskLearn/microblog/db_create.py
Upvotes: 0
Views: 1004
Reputation: 189739
The shebang line is erroneous. You cannot use a relative path in the shebang (other than indirectly, via #!/usr/bin/env flask/bin/python
or similar; I don't think that works as is, but you get the general idea).
Upvotes: 1