First-Django-Application

First Django Application that I created using Clever Cloud MySQL Database

Stars
0
Committers
1

Django Project Configuration

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.

Getting Started

Prerequisites

Before you begin, ensure you have the following installed on your system:

  • Python 3.6+
  • pip (Python package installer)
  • virtualenv (Optional but recommended for isolated environments)

Installation

  1. Clone the repository:

    git clone https://github.com/prath0m/First-Django-Project.git
    cd First-Django-Project
    
  2. 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`
    
  3. Install the required dependencies:

    Install the dependencies listed in requirements.txt:

    pip install -r requirements.txt
    
  4. 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
    
  5. Create a superuser:

    To access the Django admin panel, you'll need to create a superuser account:

    python manage.py createsuperuser
    
  6. 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.

Configuration

Settings

The settings.py file in the myproject/ directory contains all the configuration options for your Django project, including:

  • DEBUG: Set to True during development. Set to False in production.
  • ALLOWED_HOSTS: Add your domain or IP address here when deploying to production.
  • DATABASES: Configure your database engine and credentials here.
  • STATIC_URL and MEDIA_URL: Define the URL paths for serving static and media files.

Environment Variables

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