Python code to creating a web application using Flask
Open anaconda and close out all enviornment:
conda deactivate
Get directory you want the git repo to be housed:
cd Desktop
Instruction for git clone:
Create git repo; copy/paste http link in anaconda: git clone https://github.com/crd3cc04/Twittoff2.git
Go to repo directory:
cd Twittoff2
Open VS Code:
code .
Instructions for virtual environment and packages install:
create enviornment: python -m venv pipenv
install packages: pip install Flask Flask-SQLAlchemy Flask-Migrate
activate envirornment: pipenv\Scripts\activate
Instructions to setup database:
flask db init #> generate app/migrations dir. will not need to run again once already ran
#run both when changing the schema:
flask db migrate #> create the db (with "alembic_version" table)
flask db upgrade
Deploy Flask App Itself: FLASK_APP_twittoff.py
Run Flask App: flask run
Import packages Requests, Basilica, and Twitter API access:
pipenv install python-dotenv requests basilica tweepy
Basilica implementation:
get API Key from the Basilica website
Twitter implementation:
get API, token, and secret tokens from Twitter Dev website. Note that tokens and sercet keys can be otained from the init file for future reference
To use Flask application you will need to create pip env
To use Tweepy application you will need to use powershell