Django Generator#
BESSER provides a code generator for Django web applications. You can create the application in two ways:
Django App with Admin Panel — A Django application with database models and CRUD functionality, accessible via Django’s admin panel.
Django App with Admin Panel & UI Components — Includes everything from the Admin Panel version, plus predefined user interfaces such as forms and templates.
Note
The Web Modeling Editor supports only the generation of Django apps with the Admin Panel. To generate a Django app with UI Components, you must use the Python API.
Check the guidelines below to learn how to generate a Django app depending on your needs:
How to Run the Web Application#
After generating the code, you can run the web application locally (either with or without containers) depending on how you configured the generator.
Keep in mind that the containerization
parameter in the code generator determines whether files for container-based deployment are included.
A. Running without containerization (containerization = False
)#
Recommendation: Use Python 3.12 or higher for optimal performance.
In this case, you will get a Django project configured to deploy with a SQLite database. Go to the project folder and run the following commands to deploy the web app.
# Install the dependencies
pip install -r requirements.txt
# Prepare the database
python manage.py makemigrations
python manage.py migrate
# Create a superuser account
python manage.py createsuperuser
# Start the development server
python manage.py runserver
B. Running with containerization (containerization = True
)#
Requirement: Docker Compose
In this case, you will get a Django project configured to deploy using software containers: one for the Django app server and another for the PostgreSQL database. Go to the project folder and run the following command.
# Run docker-compose
docker-compose up
Access the Web Application#
Admin panel
To access the admin panel of your web app, open your browser and navigate to:
- Login Credentials:
If containerized: The default username and password are both
admin
.If not containerized: Use the username and password you set in Step A (
Create a superuser account
).
Home page
If you have generated the full web app, you can also check the home page and different forms at: