Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/YonAnn99/Acrylitec/llms.txt

Use this file to discover all available pages before exploring further.

Local development for Acrylitec requires no external services and no environment variables. Django’s built-in development server (runserver) handles request serving, DEBUG = True surfaces full tracebacks in the browser, and the database is a local SQLite file that is created automatically on first migration. You can be up and running in under five minutes with nothing more than Python and a virtual environment.

Auto Database Switching

core/settings.py reads the DATABASE_URL environment variable at startup and branches on whether it is present:
DATABASE_URL = os.environ.get('DATABASE_URL')

if DATABASE_URL:
    # PRODUCTION — PostgreSQL on Railway
    DATABASES = {
        'default': dj_database_url.config(
            default=DATABASE_URL,
            conn_max_age=600,
        )
    }
else:
    # LOCAL — SQLite, no installation required
    DATABASES = {
        'default': {
            'ENGINE': 'django.db.backends.sqlite3',
            'NAME': BASE_DIR / 'db.sqlite3',
        }
    }
When DATABASE_URL is absent (the default in a fresh clone), Django automatically uses db.sqlite3 in the project root. You do not need to create or configure the file — Django creates it during the first migrate run.

Project Layout

Acrylitec/
├── core/               # Django project settings, URLs, WSGI/ASGI
├── gestion/            # Main app: models, views, templates, static
│   ├── migrations/
│   ├── templates/gestion/
│   └── static/gestion/
├── manage.py
├── Procfile            # gunicorn entry point for production
└── requirements.txt

Prerequisites

Install all dependencies from requirements.txt into a virtual environment:
python -m venv .venv
source .venv/bin/activate        # Windows: .venv\Scripts\activate
pip install -r requirements.txt
Key packages installed include Django 6.0.3, gunicorn 25.3.0, whitenoise 6.12.0, dj-database-url 3.1.2, psycopg2 2.9.11 (for PostgreSQL in production), and Pillow 12.2.0 (for product image uploads).

Running Migrations

Django’s migration system creates and updates the SQLite schema automatically. Run migrate once before starting the server, and again whenever you pull new migration files:
python manage.py migrate
This creates every table defined in gestion/migrations/ — including products, materials, cost tabuladors, quotations, and sales — inside db.sqlite3 at the project root.

Creating Initial Data

After migration, create a superuser so you can log in to both the admin panel and the Acrylitec dashboard:
python manage.py createsuperuser
Follow the prompts to set a username, email, and password. Once logged in, navigate to /configuracion/ to optionally add the materials catalogue and a cost tabulador. These seed records are required before generating quotations.

Starting the Development Server

python manage.py runserver
Django starts on http://127.0.0.1:8000/ by default. The server automatically reloads when Python source files change. Template edits take effect on the next page refresh with no restart needed.

Media Files

Product photos uploaded through the product form are stored under MEDIA_ROOT:
MEDIA_URL  = '/media/'
MEDIA_ROOT = os.path.join(BASE_DIR, 'media')   # resolves to Acrylitec/media/
When DEBUG = True, Django’s development server serves the media/ directory through the URL patterns added by django.conf.urls.static.static(). No additional configuration is needed locally — uploaded files appear immediately at /media/<filename>.

Static Files

WhiteNoise (whitenoise.middleware.WhiteNoiseMiddleware) is included in the middleware stack and serves static assets in all environments. In local development the STATICFILES_DIRS setting tells Django where to find source assets:
STATIC_URL          = 'static/'
STATIC_ROOT         = BASE_DIR / 'staticfiles'
STATICFILES_DIRS    = [BASE_DIR / 'gestion' / 'static']
STATICFILES_STORAGE = 'whitenoise.storage.CompressedManifestStaticFilesStorage'
You do not need to run collectstatic locally — runserver resolves static files from gestion/static/ directly. Run collectstatic only when preparing a production build.
Never use python manage.py runserver in a production environment. It is single-threaded, unoptimized, and not hardened against public traffic. For production, use gunicorn as declared in the Procfile:
web: gunicorn core.wsgi:application --bind 0.0.0.0:$PORT

Build docs developers (and LLMs) love