Open Neighborhood
An app for a better neighborhood. Focused on four main objectives:
- Aliquot payments management.
- Visitors management.
- Neighborhood funds management. (Divide current budget into small budgets for many purposes.)
- Entrance and payments statistics for a better neighborhood understanding.
Setup environment
By default and as expected by the DEBUG
env var the project will try to load the frontend from a dev server on port 3000 (check the frontend repo for instructions) it's not required but this way you could develop an integration feature or test without changing the url.
Requirements
- Python 3.x
- pipenv (
pip install pipenv
) - Docker (optional)
Local (no docker)
- Make sure you have installed
pipenv
see here anddocker
see here (optional) - Install all deps with
pipenv install
- Create a
.env
file with your local information. See.env.example
. - Spin up your local database and database manager (postgres and maybe pgadmin or any of your taste). Check
settings.py
for default database name and credentials or set the right environment variables. - Enable your shell with the virtual environment with
pipenv shell
or just prefix every step withpipenv run
- Make sure all migrations are applied to your local
python manage.py migrate
- Start the local server with
python manage.py runserver
With Docker
If you have docker installed follow this steps:
- Run
docker-compose up --build
to start all de containers. The build flag is needed to detect any dependency changes. This will only start a postgress database and a pgAdmin container. - Run
pipenv install
to install all dependencies required for the project. From then you can runpipenv shell
to conect the current terminal to the virtual environment or prependpipenv run
to the following steps - Within that bash terminal run
(pipenv run) python manage.py migrate
to run all migrations. - Within that bash terminal run
(pipenv run) python manage.py createsuperuser
to create the root admin. - Within that bash terminal run
(pipenv run) python manage.py runserver
to spinup the server. - Enjoy.
Deployment
The backend is continuous delivered and continuos integrated (with latest frontend master) by github actions.
To deploy the backend server with a new frontend version you must have the frontend production build
folder. You can have either build it yourself or grab it from the latest release on the frontend repo. Just drop the build folder with all of its content on the root folder. Then run python manage.py collectstatic
and commit the changes.
With docker
Freeze the dependencies with pipenv run pip freeze > requirements.txt
then docker build
it.
References
- To enter pgAdmin webadmin use the following credentials: user = super@email.com password = supperpassword
- To enter Django-Admin use the following credentials: user = admin password = admin
- The "help_text" parameter is used to specify what is expected in the database models. Bear that in mind.