Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dockerized web app #16

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
54 changes: 54 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@

.Screenshots/

# Django-related files and directories
*.pyc
*.pyo
__pycache__/
*.egg-info/
*.pyc
*.swp
*.swo
*.sqlite3

# Static files
/staticfiles/
static/

# Media files
/media/

# Environment variables and sensitive information
.env
.env.*

# IDE and editor files
.vscode/
.idea/
*.sublime*
*.swp

# Log files
*.log
logs/

# Dependency directories
venv/
env/
pipenv/
.venv/

# Compiled Python files
*.pyc
*.pyo

# Other build-related files
Dockerfile
docker-compose.yml

# Ignore everything else except the required files
*
!.dockerignore
!requirements.txt
!manage.py
!django_web_app/
52 changes: 52 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
# Django-related files and directories
*.pyc
*.pyo
__pycache__/
*.egg-info/
*.pyc
*.swp
*.swo
*.sqlite3

# Static files
/staticfiles/
static/

# Media files
/media/

# Environment variables and sensitive information
.env
.env.*

# IDE and editor files
.vscode/
.idea/
*.sublime*
*.swp

# Compiled files
*.pyc
*.pyo

# Log files
*.log
logs/

# Dependency directories
venv/
env/
pipenv/
.venv/

# Compiled Python files
*.pyc
*.pyo

# macOS-specific files
.DS_Store

# Windows-specific files
Thumbs.db

#Screenshots
24 changes: 24 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Use an official Python runtime as the base image
FROM python:3.9

# Set the working directory in the container
WORKDIR /app

# Copy the requirements file to the working directory

COPY ./requirements.txt .

COPY ./django_web_app /app/django_web_app

# Install the Python dependencies
RUN pip install --no-cache-dir -r requirements.txt

# Copy the Django project code to the working directory
WORKDIR /app/django_web_app
# Expose the port on which your Django application will run (if applicable)
EXPOSE 8000

# Run the Django development server
CMD ["python", "manage.py", "migrate"]
CMD ["python", "manage.py", "runserver", "0.0.0.0:8000"]

7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,13 @@ This project was done by me as a assignment for an internship.
python django_web_app/manage.py runserver

In your web browser enter the address : http://localhost:8000 or http://127.0.0.1:8000/

<h2>Docker Setup :</h2>

docker build -t image-name . <br>
docker run -d -p 8080:8000 image-name

Hit the browser with http://localhost:8000 or http://127.0.0.1:8000/

# Working:
[![Watch the video](https://img.youtube.com/vi/qIK-vfTig6c/0.jpg)](https://youtu.be/qIK-vfTig6c)
Expand Down
2 changes: 1 addition & 1 deletion django_web_app/blog/templates/blog/base.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{% load staticfiles %}
{% load static %}
<!doctype html>
<html lang="en">
<head>
Expand Down
Binary file modified django_web_app/db.sqlite3
Binary file not shown.
2 changes: 1 addition & 1 deletion django_web_app/django_web_app/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))


DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField'
# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/2.1/howto/deployment/checklist/

Expand Down
52 changes: 0 additions & 52 deletions django_web_app/media/Files/main.py

This file was deleted.

2 changes: 1 addition & 1 deletion django_web_app/users/templates/users/login.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
{% csrf_token %}
<fieldset class="form-group">
<legend class="border-bottom mb-4">Log In</legend>
{{ form|crispy }}
{{ form }}
</fieldset>
<div class="form-group">
<button class="btn btn-outline-info" type="submit">Login</button>
Expand Down
2 changes: 1 addition & 1 deletion django_web_app/users/templates/users/register.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
{% csrf_token %}
<fieldset class="form-group">
<legend class="border-bottom mb-4">Join Today</legend>
{{ form|crispy }}
{{ form }}
</fieldset>
<div class="form-group">
<button class="btn btn-outline-info" type="submit">Sign Up</button>
Expand Down
Binary file added requirements.txt
Binary file not shown.