I'm learning flask through tutorials.Now I stuck on making database file because they just provide unix command to execute that script my question is which command do i use if i want to install that "db_create.py" file from command prompt that i've mention below..I'm running on virtual enviroment with directory project in cmd.
#!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 have also install SQLAlchemy.
If it's already specified in the first line the interpreter of this script, then you just have to grant the script the executable permits in order for it to run. Hence just type the following command, if you are on UNIX-based machine:
And then just execute:
Otherwise if you are on a Windows-based machine, move into the folder of the script and just run:
Hope it works!