First Django Application that I created using Clever Cloud MySQL Database
This project is a web application built using Django, a high-level Python web framework that encourages rapid development and clean, pragmatic design. This README provides instructions on setting up and configuring the Django environment.
Before you begin, ensure you have the following installed on your system:
Clone the repository:
git clone https://github.com/prath0m/First-Django-Project.git
cd First-Django-Project
Create and activate a virtual environment:
It's recommended to use a virtual environment to isolate your project's dependencies.
python3 -m venv venv
source venv/bin/activate # On Windows use `venv\Scripts\activate`
Install the required dependencies:
Install the dependencies listed in requirements.txt
:
pip install -r requirements.txt
Set up the database:
Django uses SQLite by default, but you can configure other databases like PostgreSQL or MySQL. Run the following commands to set up your database:
python manage.py migrate
Create a superuser:
To access the Django admin panel, you'll need to create a superuser account:
python manage.py createsuperuser
Run the development server:
Start the Django development server to see your application in action:
python manage.py runserver
Visit http://127.0.0.1:8000/
in your web browser to view the application.
The settings.py
file in the myproject/
directory contains all the configuration options for your Django project, including:
True
during development. Set to False
in production.It's a good practice to store sensitive information like SECRET_KEY
, database credentials, and API keys in environment variables. You can use the python-decouple
package or similar tools to manage environment variables:
pip install python-decouple