Simple web-based expense manager application.
The following requirements need to be satisfied to setup the project.
- Python - While the project may work with any Python version above 3.5 it is actively developed using 3.10 and it is the officially supported version. Use any other Python version at your own risk.
- Pipenv - Used for installing backend dependencies. The latest version is the one usually used for development but the tool is stable and most versions should work flawlessly.
- NodeJS - The project is currently using the latest LTS version.
- NPM - Used for installing frontend dependencies. Use the one that usually comes with the latest LTS version of Node but a newer one should also work.
- SassC - The project uses SassC libsass driver for compiling Sass code to plain CSS. Check the official repository to find out how to get SassC installed on your system. For Debian-based Linux distributions, you can just install it -
sudo apt install sassc
.
- Navigate to the project's root directory.
- Run
npm install
to install the frontend dependencies. - Execute
pipenv install
to install the backend dependencies. - Type
pipenv run migrate
to apply all database migrations. Currently, the default database is SQLite. Edit the settings.py file if you want to use MySQL/MariaDB or PostgreSQL. Read the official Django documentation to learn more.
Start the development server using pipenv run server
and navigate to http://localhost:8000 in your browser.
If you need admin access you can create a privileged user by executing pipenv run manage createsuperuser
.
If you need to execute something else within the project's environment, you can enter the environment using pipenv shell
.
The project can also be started from a Docker container either by running it manually or using the existing docker-compose manifest. The latter is preconfigured to use PostgreSQL database and nGINX as HTTP server. If you choose not to use docker-compose, you will have to configure these services manually.
If you want to use the debug toolbar, you should add the gateway IP of the container to INTERNAL_IPS
. To find the IP, use docker inspect <identifier>
.
Use the following steps to prepare and run the dev image:
- Configure the database connection in the settings. You can use SQLite or configure your own database server.
- Navigate to the project's root directory.
- Build the image with
docker build -f Dockerfile.dev -t contuga-web .
- Run the docker container using
docker run -it -p 8000:8000 -v $(pwd):/usr/src/app/ contuga-web
- Access the app at http://localhost:8000.
- You can now edit the source files and the changes will be applied to the running app.
Use the following steps to prepare and run the prod image:
- Configure the database connection in the settings. You can use SQLite or configure your own database server.
- Navigate to the project's root directory.
- Build the image with
docker build -t contuga-web .
- Run the docker container using
docker run --network=host -v contuga-web-static:/usr/src/app/static -v contuga-web-media:/usr/src/app/media contuga-web
- Configure your HTTP server to connect with the running WSGI application and to serve the two directories under
/static
and/media
. You can use the existing nginx.conf as an example. You can check if the WSGI application is up and running by accessing http://localhost:8000.
If you are using the Compose plugin, Docker Compose can be used directly from the docker cli via docker compose
. If you are using the standalone Compose, use docker-compose
. The instruction in this section will use the Compose plugin but docker-compose
will also work.
Use the following steps to start the app in dev mode:
- Configure the database connection in the settings.
- Run
docker compose -f docker-compose.dev.yaml up
to start the services. - You can now edit the source files and the changes will be applied to the running app.
- Access the app at http://localhost:8000.
To use ipdb
or pdb
, you have to attach to the container first with docker attach contuga-web-web-1
.
Use the following steps to start the app in prod mode:
- Configure the database connection in the settings.
- Run
docker compose up
to start the services. - Access the app at http://localhost.