- Development Environment: notebooks.ai
- Production Environment: pythonanywhere.com
- Source Code Repository: GitHub (this repo)
- Flask
- sqlite3
- flask_sqlalchemy
- https://hackersandslackers.com/author/todd/
- https://hackersandslackers.com/series/building-flask-apps/
- https://www.cs.rochester.edu/u/bdicken3/csc210/
- https://www.cs.rochester.edu/u/bdicken3/csc210/slides/Lecture_07_Introduction_to_Flask.pdf
- http://zetcode.com/python/flask/
- https://www.twilio.com/blog/how-run-flask-application
- https://smallbusiness.chron.com/use-sqlite-ubuntu-46774.html
- https://help.pythonanywhere.com/pages/Flask/
- To install flask
$pip install -U Flask
- To install -U flask_sqlalchemy
$pip install -U flask_sqlalchemy
- "-U" = "--updates"
- To combine 1 and 2 into a single requirements.txt file The requirements.txt file contains two simple lines:
flask
flask_sqlapchemy
$install -r requirements.txt
- to Run flask
-
$export FLASK_APP="/app/webapps/hello/hello.py"
-
$flask run
- How to install sqlite3 on ubuntu?
$apt-get install sqlite3 libsqlite3-dev
or
$sudo apt-get install sqlite3 libsqlite3-dev
if you are not admin/root
- How to create a new database?
$sqlite3 dbname.db
This will take you to sqlite3 interactive shell sqlite>
sqlite>.help
for helpsqlite3>.quit
to exitsqlite>.read myscript.sql
to run a SQL scriptsqlite>select * from cities;
to run a query
- How to connect to an existing DB?
$sqlite3 dbname.db
or
$sqlite3
then sqlite>.open dbname.db
- on Windows, open git bash shell
$ssh das10
$cd pythonwork
$git clone https://github.com/wcj365/flask-sql.git
$cd flask-sql
$python3 -m venv venv
$source venv/bin/activate
(venv)$pip install -r requirements.txt