Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/dev-vivekkumarverma/django-app-dockerisation
Dockerised Django app backend (DRF) with database( postgresql ) running in same network but in different container.
https://github.com/dev-vivekkumarverma/django-app-dockerisation
django django-application django-rest-framework docker docker-compose docker-network dockerfile dockerizing-django-app
Last synced: 3 months ago
JSON representation
Dockerised Django app backend (DRF) with database( postgresql ) running in same network but in different container.
- Host: GitHub
- URL: https://github.com/dev-vivekkumarverma/django-app-dockerisation
- Owner: dev-vivekkumarverma
- Created: 2024-06-21T09:17:48.000Z (6 months ago)
- Default Branch: main
- Last Pushed: 2024-06-21T09:45:13.000Z (6 months ago)
- Last Synced: 2024-09-28T16:23:22.300Z (3 months ago)
- Topics: django, django-application, django-rest-framework, docker, docker-compose, docker-network, dockerfile, dockerizing-django-app
- Language: Python
- Homepage:
- Size: 7.81 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Django App Dockerization
This repository contains a Django application `say_current_time` that is containerized using Docker. Follow the instructions below to clone the repository, navigate to the project directory, and run the project using Docker Compose.
## Prerequisites
Ensure you have the following installed on your system:
- Docker
- Docker Compose
- PostgreSQL (running in the same network `testnetwork`)## Clone the Repository
Clone the repository to your local machine using the following command:
```sh
git clone
```Replace `` with the actual URL of your GitHub repository.
## Navigate to the Project Directory
Change your directory to the cloned repository:
```sh
cd django-app-dockerisation
```## Project Structure
The project directory contains the following structure:
```
django-app-dockerisation/
│
├── saycurrenttime/
│ ├── __init__.py
│ ├── asgi.py
│ ├── settings.py
│ ├── urls.py
│ ├── wsgi.py
│
├── Dockerfile
├── docker-compose.yaml
├── manage.py
├── README.md
├── requirements.txt
├── start.sh
└── .env
```## Environment Variables
The environment variables required for the database configuration are stored in the `.env` file. Ensure your `.env` file contains the following variables:
```
db_engine=django.db.backends.postgresql
db_host=
db_port=
db_user=
db_pass=
db_name=
```Replace ``, ``, ``, ``, and `` with the actual values for your PostgreSQL database.
## Build and Run the Project
Use Docker Compose to build and run the project:
```sh
docker-compose up -d --build
```This command will build the Docker image and start the containers in detached mode.
## Access the Application
The application will be accessible at `http://localhost:8000`.
## Stopping the Application
To stop the application, use the following command:
```sh
docker-compose down
```This will stop and remove the containers created by Docker Compose.