gal16v8d/candc-svc
Wiki repo for C&C games
C&C service
Flask + SQLAlchemy + PostgreSQL REST API for C&C Wiki
This project was created using Poetry.
Basically, its a really basic API wiki view for all the data related to C&C games.
This is still WIP, so it may get some data updates soon.
Get started
Unix
Install poetry:
curl -sSL https://install.python-poetry.org | python3 -Init repo:
poetry new candc-svcCreate the virtual env folder:
mkdir .venvInstall all the dependencies in the project (clean-state):
poetry installInstall any dependency you need:
poetry add lib_hereRemove a dependency you don't need:
poetry remove lib_hereUpdate all (updatable) libs
poetry updateSet up
env
Activate using the command:
source .venv/bin/activateor
eval $(poetry env activate)Exit virtual env:
exitor
deactivatesqlalchemy
For init db:
flask db initMigrate:
flask db migrateConfirm/apply in db:
flask db upgradelaunch
Dev mode:
flask runProd run:
gunicorn --workers {# workers here} --bind 0.0.0.0:{port here} wsgi:apptest
pytest --covautomation
Run the server using the command on launch section
Then open another console, activate the env and go to automation folder
Once there run the tests using:
behaveYou can see the console output with several features, scenarios and steps and its status as passed, failed or skipped.
Advanced use cases
If multiple python versions are found in the operative system, then
- use pyenv to handle the versions
- if needed set the local python for this project, like
pyenv local 3.12.1- you can confirm all good by checking
pyenv which python- set the specific python version like
poetry env use $USER_HOME/.pyenv/versions/3.12.1/bin/python- then install using commands like the ones in the previous section
Formatter
Using black as code formatter
Can be used this way:
poetry run black .Type checking
Using mypy for type checking
Can be used this way:
poetry run mypy app testsswagger docs (flask-restx)
http://{host}:{port}
Web deployment
This app can be hosted in Railway, folder that helps with it is .ci folder.
List of cool technologies in use here
License
Stay in touch
- Author - gal16v8d
