This is Sakib's boilerplate Flask App that uses Flask, SQLAlchemy, and rAuth for user authentication. All instances of "xd" should be replaced with the name of your app or authorization provider.
After going into the directory, these are the steps to get the app up and running locally:
Create a new Virtual Environment for the project and source it. If you don't have Virtual Environment yet, you can find installation instructions here.
$ virtualenv venv
$ source venv/bin/activate
Next we need to install the project dependencies, which are listed in requirements.txt
.
(venv) $ pip install -r pip.req
Enter the MySQL shell and create a flask app user and database running locally. If you don't have MySQL yet, you can find installation instructions here.
mysql> create database xd;
mysql> create user 'xd'@'localhost' identified by 'xd';
mysql> grant all privileges on xd.* to 'xd'@'localhost';
Now apply the models defined in the flask app as such:
(venv) $ ./migrate.py db init
(venv) $ ./migrate.py db migrate
(venv) $ ./migrate.py db upgrade
For most table changes, edit xd/models.py, and run the above migrate and upgrade commands again.
If you happen to change a foreign key, or delete the migrations folder, run the above init, migrate and upgrade commands again.
Now we're ready to start our server which is as simple as:
(venv) $ ./run.py
If we want to expose this to a public facing URL, we can use ngrok:
(venv) $ ./ngrok http 5000
Built by Sakib Jalal at Rutgers University, kept under the MIT License.