macatw / dockerize-django-with-nextjs

Dockerize a Django Project with Nextjs using Nginx and Docker

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Coding for Innovations Logo

For Programmers, By Programmers.

Dockerize Django with Nextjs

A Bootstrapped Template of Django with Nextjs using Docker!

Youtube Video: Link

πŸ“š Stack

  • Next Js - The React Framework for the Web.

  • Django - Django makes it easier to build better web apps more quickly and with less code.

  • Typescript - JavaScript with syntax for types.

  • Docker - Docker is a platform designed to help developers build, share, and run modern applications. We handle the tedious setup, so you can focus on the code.

  • Nginx - Advanced Load Balancer, Web Server, & Reverse Proxy.

    πŸ“Έ Screenshots:

  • Frontend:

Webpage

  • Backend:

Backend

πŸ“ Project structure

$PROJECT_ROOT
β”‚  
β”œβ”€β”€ apps/web  # Django Backend
β”‚  
β”œβ”€β”€ apps/docker  # Docker files for web, www, nginx
β”‚  
β”œβ”€β”€ apps/www  # Nextjs App
β”‚   
β”œβ”€β”€ apps/web/requirements # Python Requirements
β”‚
β”œβ”€β”€ apps/web/manage.py # Run Django Commands
β”‚
β”œβ”€β”€ apps/www/package.json # npm commands.

πŸ† Getting Started:

  • Clone Repo
mkdir dockerize-django-with-nextjs
cd dockerize-django-with-nextjs
git clone https://github.com/codingforinnovations/dockerize-django-with-nextjs .
  • Using Docker
docker-compose up --build

Open Django Server in : http://0.0.0.0:8000

Open Django Admin in : http://0.0.0.0:8000/admin

Open Nextjs Server in : http://0.0.0.0

Manual Way:

For Django:

  • Create Virtual Environment for Python
pip install virtualenv
python -m venv .
  • Activate Virtual Environment
source Scripts/activate

Window Users use: .\Scripts\activate

  • Install Dependencies
pip install -r apps/web/requirements.txt
  • Make Migrations
python manage.py apps/web/makemigrations
python manage.py apps/web/migrate

For Frontend

  • Install Dependencies
npm install --prefix apps/www
  • Run Dev Server
npm run dev
  • Now for Bundling Your Frontend
npm run build

🎫 LICENSE:

MIT LICENSE .

πŸ†• Change Log:

Change Log .

Other places you can find us:
YouTube

About

Dockerize a Django Project with Nextjs using Nginx and Docker

License:MIT License


Languages

Language:CSS 33.0%Language:Python 32.7%Language:TypeScript 21.9%Language:JavaScript 6.1%Language:Dockerfile 4.5%Language:Shell 1.8%