A monolithic Django project with HTMX, Alpine.js, and Bootstrap.
-
Clone the repository and create a virtual environment:
git clone <repository-url> cd ce-tracking python -m venv venv source venv/bin/activate # On Windows, use `venv\Scripts\activate`
-
Install Python dependencies:
pip install -r requirements.txt
-
Set up environment variables:
- Copy the
.env.example
file to.env
. - Generate a new
SECRET_key
and update the.env
file.
- Copy the
-
Run database migrations:
python manage.py migrate
- Start the Django development server:
- In a terminal, run:
python manage.py runserver
- In a terminal, run:
The application will be available at http://127.0.0.1:8000/
.
These instructions are for deploying the application on a server using Apache.
-
Install Apache and mod_wsgi:
# On Debian/Ubuntu sudo apt-get update sudo apt-get install apache2 libapache2-mod-wsgi-py3 # On RHEL/CentOS sudo yum install httpd mod_wsgi
-
Configure Apache:
- Create a new configuration file for your site in
/etc/apache2/sites-available/cets.conf
(Debian/Ubuntu) or/etc/httpd/conf.d/cets.conf
(RHEL/CentOS). - Add the following content to the file, replacing the placeholders with your actual paths and domain name:
<VirtualHost *:80> ServerName your_domain.com ServerAlias www.your_domain.com Alias /static/ /path/to/your/project/static/ <Directory /path/to/your/project/static> Require all granted </Directory> <Directory /path/to/your/project/cets> <Files wsgi.py> Require all granted </Files> </Directory> WSGIDaemonProcess cets python-home=/path/to/your/project/venv python-path=/path/to/your/project WSGIProcessGroup cets WSGIScriptAlias / /path/to/your/project/cets/wsgi.py </VirtualHost>
- Create a new configuration file for your site in
-
Enable the site and restart Apache:
# On Debian/Ubuntu sudo a2ensite cets.conf sudo systemctl restart apache2 # On RHEL/CentOS sudo systemctl restart httpd
-
Collect Static Files: Before starting the server, you need to collect all static files into a single directory.
python manage.py collectstatic