Skip to content

Commit

Permalink
secret key and debug added to env variables
Browse files Browse the repository at this point in the history
  • Loading branch information
budescode committed Feb 7, 2024
1 parent 52de19f commit e12e921
Show file tree
Hide file tree
Showing 7 changed files with 14 additions and 7 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/docker-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ jobs:
envkey_POSTGRES_PASSWORD: ${{ secrets.POSTGRES_PASSWORD }}
envkey_CERTBOT_EMAIL: ${{ secrets.CERTBOT_EMAIL }}
envkey_CERTBOT_DOMAIN: ${{ secrets.CERTBOT_DOMAIN }}
envkey_DEBUG: ${{ secrets.DEBUG }}
envkey_SECRET_KEY: ${{ secrets.SECRET_KEY }}

file_name: .env
fail_on_empty: false
Expand Down
Binary file modified db.sqlite3
Binary file not shown.
Binary file modified index/__pycache__/views.cpython-310.pyc
Binary file not shown.
Binary file modified project/__pycache__/settings.cpython-310.pyc
Binary file not shown.
8 changes: 6 additions & 2 deletions project/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,10 @@
"""

import os
from dotenv import load_dotenv

# Load environment variables from .env file
load_dotenv()
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))

Expand All @@ -20,10 +23,10 @@
# See https://docs.djangoproject.com/en/3.0/howto/deployment/checklist/

# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = 'unb1m%jfh^3zb^5x&jweq$-^dfi1_3m_sze%80osq0xu+c@b@!'
SECRET_KEY = os.environ.get('SECRET_KEY')

# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True
DEBUG = os.environ.get('DEBUG')

ALLOWED_HOSTS = ['*']

Expand Down Expand Up @@ -118,6 +121,7 @@
# https://docs.djangoproject.com/en/3.0/howto/static-files/

STATIC_URL = '/static/'

STATIC_ROOT = os.path.join(BASE_DIR, 'static')
MEDIA_URL = '/media_cdn/'
MEDIA_ROOT = os.path.join(BASE_DIR, 'media_cdn')
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ idna==3.4
Pillow==9.1.1
psycopg2==2.9.3
psycopg2-binary==2.9.3
python-dotenv==1.0.1
pytz==2022.7.1
requests==2.28.2
sqlparse==0.4.3
Expand Down
10 changes: 5 additions & 5 deletions templates/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ <h1>LIST OF BOOKS</h1>
{% for i in qs %}
<div>
<ul>
<img src="{{ i.image.url }}">
<img src="{{ i.image.url }}" width="100" height="100">
<li>Name: {{ i.name }}</li>
<li>Description: {{ i.description }}</li>
<li>Author: {{ i.author }}</li>
Expand All @@ -17,9 +17,9 @@ <h1>LIST OF BOOKS</h1>

<h5>POST A BOOK</h5>
<form method="post" action="" enctype="multipart/form-data"> {% csrf_token %}
<input type="text" name="name" placeholder="name"> <br>
<input type="text" name="author" placeholder="author"> <br>
<input type="file" name="image"> <br>
<textarea placeholder="description" name="description"></textarea><br>
<input type="text" name="name" placeholder="name" required> <br>
<input type="text" name="author" placeholder="author" required> <br>
<input type="file" name="image" required> <br>
<textarea placeholder="description" name="description" required></textarea><br>
<input type="submit" value="submit">
</form>

0 comments on commit e12e921

Please sign in to comment.