Skip to content

Commit e002ddb

Browse files
committed
Add base sh, base structure, requirement handling
1 parent f72e291 commit e002ddb

File tree

18 files changed

+238
-0
lines changed

18 files changed

+238
-0
lines changed

base_constructor.sh

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
#!/usr/bin/env bash
2+
3+
echo "Welcome to pyflask base constructor"
4+
5+
# Check for venv, conda else exit
6+
7+
echo "Installing pip-tools . . ."
8+
pip install pip-tools
9+
10+
echo "Generating requirements"
11+
pip-compile --output-file=requirements/requirements.txt requirements/requirements.in
12+
13+
echo "Generating dev requirements"
14+
pip-compile --output-file=requirements/dev-requirements.txt requirements/dev-requirements.in
15+
16+
echo "Installing requirements"
17+
pip install -r requirements/requirements.txt
18+
19+
echo "Installing dev requirements"
20+
pip install -r requirements/dev-requirements.txt

documentation/conda.md

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# Conda documentation
2+
3+
### 1. Install Pip
4+
### 2. Install Anaconda
5+
##### Linux
6+
`wget https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh`
7+
8+
`bash ./Miniconda3-latest-Linux-x86_64.sh`
9+
10+
##### MacOS
11+
`brew cask install anaconda`
12+
13+
`export PATH="/usr/local/anaconda3/bin:$PATH"`
14+
15+
##### Create conda virtual env
16+
`conda create -n pyflask-base python=3.8`
17+
18+
```
19+
#
20+
# To activate this environment, use
21+
#
22+
# $ conda activate pyflask-base
23+
#
24+
# To deactivate an active environment, use
25+
#
26+
# $ conda deactivate
27+
```
28+
29+
##### Run conda virtual env
30+
`conda activate pyflask-base`
31+
32+

documentation/flask.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# Introduction to Flask
2+
3+
Flask [Homepage](https://flask.palletsprojects.com/en/1.1.x/)
4+
5+
# Tutorial
6+
7+
Follow [The Flask Mega-Tutorial Part I: Hello, World!](https://blog.miguelgrinberg.com/post/the-flask-mega-tutorial-part-i-hello-world)

requirements/dev-requirements.in

Whitespace-only changes.

requirements/dev-requirements.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#
2+
# This file is autogenerated by pip-compile
3+
# To update, run:
4+
#
5+
# pip-compile --output-file=requirements/dev-requirements.txt requirements/dev-requirements.in
6+
#

requirements/requirements.in

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
Flask
2+
dynaconf
3+
flask_apispec
4+
flask_cors

requirements/requirements.txt

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
#
2+
# This file is autogenerated by pip-compile
3+
# To update, run:
4+
#
5+
# pip-compile --output-file=requirements/requirements.txt requirements/requirements.in
6+
#
7+
apispec==3.3.1 # via flask-apispec
8+
click==7.1.2 # via flask
9+
dynaconf==3.0.0 # via -r requirements/requirements.in
10+
flask-apispec==0.9.0 # via -r requirements/requirements.in
11+
flask-cors==3.0.8 # via -r requirements/requirements.in
12+
flask==1.1.2 # via -r requirements/requirements.in, flask-apispec, flask-cors
13+
itsdangerous==1.1.0 # via flask
14+
jinja2==2.11.2 # via flask
15+
markupsafe==1.1.1 # via jinja2
16+
marshmallow==3.7.1 # via flask-apispec, webargs
17+
six==1.15.0 # via flask-apispec, flask-cors
18+
webargs==5.5.3 # via flask-apispec
19+
werkzeug==1.0.1 # via flask

service_master.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
from dynaconf import settings
2+
3+
from src.app import app
4+
from src.core import Logger
5+
6+
log = Logger()
7+
8+
9+
if __name__ == "__main__":
10+
log.info(f"Created app instance. Initiating run . . .")
11+
app.run(
12+
host=settings.API.SERVER.url,
13+
port=settings.API.SERVER.port,
14+
debug=settings.DEBUG,
15+
)

src/__init__.py

Whitespace-only changes.

src/app.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
from src.core import Logger
2+
from src.routes import register_blueprints
3+
from src.server import Server
4+
5+
log = Logger()
6+
7+
log.info(f"Creating app instance . . .")
8+
server = Server() # Generate singleton instance of server
9+
app = server.get_app() # Get Flask app reference from server instance
10+
log.info(f"Registering blueprints . . .")
11+
register_blueprints(app) # Register all blueprints to app reference
12+

0 commit comments

Comments
 (0)