Changes to be committed:

modified:   README.md
	new file:   app/logger.py
	new file:   app/main.py
	new file:   configs/app.json
	new file:   configs/logger.ini
	new file:   run.py
This commit is contained in:
2021-05-23 15:50:45 -07:00
parent fd1ae40dfa
commit 39e6c9685a
6 changed files with 60 additions and 0 deletions

View File

@@ -0,0 +1,36 @@
## Install enviorment
When possible use a virtual enviromnet. PyPy3.x or python3.9 (or the current versions)
### macOS
If you already have current python or pypy installed you can skip this otherwise type the following at your terminal: `brew install python@3.9 pypy3`
You may also need to install/update pip for pypy.
```
pip_pypy3 install --upgrade pip setuptools
```
On macOS you may get the warning from brew that the tools are not in your path.
You can set it by entering
```
export PATH=$PATH:/usr/local/share/pypy3
```
### Virtual Enviorment
Create your virtual enviorment. In some instances you may need to set your python interpetur enviorment.
`export PYTHONENV=$(pwd)` will set it to your current directory.
#### Setting up PyPy
```
cd <YOURAPP_NAME>
pypy3 -mvenv .venv
. .venv/bin/activate
```
_Note: that `.venv` is what ever path you want your enviroment to be set in. This example opts to make it a hidden folder `.`.
### Installing dependancy
```
pip3 install ipython requests httpx fastapi uvicorn ormar ujson loguru jinja2 aiofiles aiosqlite aiomysql
```
_Note: If you want to use ujson or orjson you will need to install additional tools esp w/ pypy.

3
app/logger.py Normal file
View File

@@ -0,0 +1,3 @@
from loguru import logger

13
app/main.py Normal file
View File

@@ -0,0 +1,13 @@
from fastapi import FastAPI
from .logger import logger
async def app_builder(**kwargs) -> FastAPI:
'''
Create FastAPI app
'''
app = FastAPI()
return app
app = app_builder()

0
configs/app.json Normal file
View File

0
configs/logger.ini Normal file
View File

8
run.py Normal file
View File

@@ -0,0 +1,8 @@
import uvicorn
from app import main
from loguru import logger
app = main.app
if __name__ == '__main__':
uvicorn('app.main:app', host=app.host, port=app.port)