Skip to content

joeygrable94/GCAPI-Backend

Repository files navigation

GCAPI Backend

CodeQL GitHub CI codecov


Getting Started

First check to ensure Python 3.12 is installed and is the current version in use.

python3 --version
> python3.12

Create a virtual environment, activate it, then install the backend python pip requirements.dev.txt file.

python3.12 -m venv venv
source venv/bin/activate
python -m pip install --upgrade pip
python -m pip install poetry
poetry install
uvicorn app.main:app --host 0.0.0.0 --port 8888 --log-level info --reload
> ... App Running at 0.0.0.0:8888
> :q
source venv/bin/deactivate

Application Structure


Security Resources

Hashing and Encrypting Data

Examples:

Session Management


FastAPI Resources


Alembic

Configuration

First, run the alembic init command and specify where the migrations are to be stored.

alembic init alembic

Next edit the alembic.ini file to the location of the initialized alembic directory

[alembic]
script_location = alembic

Last, edit the env.py file in the migrations directory to include your config and db base to migrate.

Commands

Check current db version.

alembic current

After changing db models/tables, run revision, and autogenerate. Always add a message about what changed in the db models/tables.

alembic revision --autogenerate -m "added table ____"
alembic upgrade head
alembic upgrade +1
alembic downgrade -1
alembic downgrade base

SQLAlchemy ORM

Pagination


PyTest

PyTest Commands

pytest
pytest tests/crud
pytest tests/api/api_v1/test_websites.py

PyTest Resources


External Resources


Useful Commands

Delete DS_Store files

find . -name '.DS_Store' -type f -delete

Delete all python cache files

find . | grep -E "(/__pycache__$|\.pyc$|\.pyo$)" | xargs rm -rf

About

No description, website, or topics provided.

Resources

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages