A simple invoicing app made in Django for the "Scripting Languages" course at the School of Computing, Belgrade.
- Python 3
- Django
- MySQL 5.7+
- The
run-mysql.sh
script can be used on Linux/macOS operating systems to run MySQL server in a Docker container.- Using this script in the production environments is heavily discouraged.
- The script is used such as:
MYSQL_ROOT_PASSWORD=... ./hack/run-mysql.sh
. - The script creates
mysql
directory in the./hack
directory mounted as/var/lib/mysql
in the container. This directory is included in the.gitignore
file.
- The
- MySQL Python client (
mysqlclient
)
Requirements regarding Python/Django dependencies can be found in the requirements.txt
file.
The requirements.txt
file can be generated by running the following command:
pip freeze > requirements.txt
Before being able to reconcile the database and deploy the application, you must populate secrets required for
application to work. The secrets should be placed in the ./invoices/secrets.py
file.
The ./invoices/secrets.py.tpl
file can be used as a template to create the secrets.py
file.
The database is generated and reconciled by creating and applying migrations. That can be done by using the manage.py
script:
python manage.py makemigrations invoices_app
python manage.py migrate
Note: The database has to be created before applying migrations.
The application requires authentication and authorization in order to access and manage invoices. Users can be created
using the application's register form (available on the /accounts/register
endpoint). Users and permissions can be
managed by using Django's built-in Admin panel.
Before you get started, you have to manually create an initial superuser account in order to access the Admin panel.
That can be done by using the manage.py
script:
python manage.py createsuperuser
The following permissions are used by the application:
- login required to preview invoices
-
invoices_app.change_invoice
required to create, edit, and manage invoices and invoice items -
invoices_app.delete_invoice
required to delete invoices
By default, users created using the register form are created without any permissions set.
The development server can be started by running the following command from the project's root directory. The command
starts a server on the port 8000
by default.
python manage.py runserver
This project is licensed under the Apache 2 license.