- Notifications
You must be signed in to change notification settings - Fork0
This repository demonstrates how to containerize a Django application with a PostgreSQL database using Docker
License
barzansaeedpour/docker_django_postgresql
Folders and files
| Name | Name | Last commit message | Last commit date | |
|---|---|---|---|---|
Repository files navigation
This repository demonstrates how to containerize a Django application with a PostgreSQL database using Docker. Docker allows you to package your application, its dependencies, and the database into separate containers, providing a consistent and portable environment for development and deployment.
Before getting started, make sure you have the following prerequisites installed on your machine:
- Docker:Install Docker
- Docker Compose:Install Docker Compose
Follow the steps below to run the Django application with PostgreSQL using Docker:
Clone this repository:
git clone https://github.com/barzansaeedpour/docker_django_postgresql.gitcd docker_django_postgresqlBuild the Docker images and start the containers:
docker-compose up --build
The
docker-compose.ymlfile defines the services for the Django application and the PostgreSQL database. Running the command above will build the necessary Docker images and start the containers.Access the Django application in your web browser:
http://localhost:8000Access the PostgreSQL database using a database client:
- Host:
localhost - Port:
5432 - Username:
postgres - Password:
postgres - Database:
postgres
- Host:
The project structure is organized as follows:
.├── docker-compose.yml├── Dockerfile├── README.md├── testproject│ ├── __init__.py│ ├── settings.py│ ├── asgi.py│ ├── urls.py│ └── wsgi.py├── manage.py└── requirements.txtdocker-compose.yml: The Docker Compose configuration file that defines the services and their configurations, including the Django application and the PostgreSQL database.Dockerfile: The Dockerfile that describes how to build the Docker image for the Django application.README.md: This file, providing instructions and information about the project.testproject/: The Django application directory.settings.py: The Django project settings file.urls.py: The Django project URLs configuration.wsgi.py: The WSGI application entry point.
manage.py: The Django management script.requirements.txt: The Python dependencies file for the Django application.
You can customize the Django application, the PostgreSQL configuration, or the Docker setup according to your project requirements. Here are some possible modifications:
- Update the Django application code inside the
djangoappdirectory. - Modify the
docker-compose.ymlfile to adjust service configurations, add environment variables, or mount volumes. - Extend the
Dockerfileto install additional dependencies or perform custom setup steps. - Customize the PostgreSQL configuration by modifying the
docker-compose.ymlfile.
If you have any suggestions, improvements, or bug fixes, please feel free to contribute to this repository. Fork the repository, make your changes, and submit a pull request.
This project is licensed under theMIT License.
Feel free to adjust and expand thisREADME.md file to fit the specific needs and details of your Django project with PostgreSQL using Docker.
About
This repository demonstrates how to containerize a Django application with a PostgreSQL database using Docker
Topics
Resources
License
Code of conduct
Contributing
Security policy
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Releases
Packages0
Uh oh!
There was an error while loading.Please reload this page.