Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/prath0m/first-django-application

First Django Application that I created using Clever Cloud MySQL Database
https://github.com/prath0m/first-django-application

clevercloud django-application mysql mysql-database python

Last synced: about 1 month ago
JSON representation

First Django Application that I created using Clever Cloud MySQL Database

Awesome Lists containing this project

README

        

# 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:**

```bash
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.

```bash
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`:

```bash
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:

```bash
python manage.py migrate
```

5. **Create a superuser:**

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

```bash
python manage.py createsuperuser
```

6. **Run the development server:**

Start the Django development server to see your application in action:

```bash
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:

```bash
pip install python-decouple