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

Keep secret key secret #29

Open
wants to merge 1 commit 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
15 changes: 15 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -117,3 +117,18 @@ media/
# **/migrations/**
# !**/migrations
# !**/migrations/__init__.py


# ignoring .env files
College-ERP/CollegeERP/.env
#ignored my own virtual environment(you can comment this line)
College-ERP/env

#also it not a good practice to commit the migrations files and _pycache files to git therefore they are also ignored
College-ERP/apis/__pycache__
College-ERP/CollegeERP/__pycache__
College-ERP/info/__pycache__
College-ERP/info/migrations

#if these are not ignored means they were commited before so run the command "git rm -r --cached ." to clear commit cache
# then add the files and commit again also check for paths of these files in your local host
Binary file removed CollegeERP/__pycache__/__init__.cpython-36.pyc
Binary file not shown.
Binary file removed CollegeERP/__pycache__/__init__.cpython-37.pyc
Binary file not shown.
5 changes: 0 additions & 5 deletions CollegeERP/__pycache__/desktop.ini

This file was deleted.

Binary file removed CollegeERP/__pycache__/settings.cpython-36.pyc
Binary file not shown.
Binary file removed CollegeERP/__pycache__/settings.cpython-37.pyc
Binary file not shown.
Binary file removed CollegeERP/__pycache__/urls.cpython-36.pyc
Binary file not shown.
Binary file removed CollegeERP/__pycache__/urls.cpython-37.pyc
Binary file not shown.
Binary file removed CollegeERP/__pycache__/wsgi.cpython-36.pyc
Binary file not shown.
10 changes: 9 additions & 1 deletion CollegeERP/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,17 @@
# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/2.1/howto/deployment/checklist/

import environ

env = environ.Env()

# Read .env file and load its contents into os.environ
environ.Env.read_env()

# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = 'jy8c-n9y=pf##!2^jae-l_5iafq6q%wfq8gdb6c0r5d52su+9y'
SECRET_KEY = env('SECRET_KEY')

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

Expand Down
16 changes: 16 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -94,3 +94,19 @@ This will delete all present attendance data and create new attendance objects f
![alt text](https://imgur.com/tMKWx6f.png)

![alt text](https://imgur.com/PvCsNeB.png)

//Secret key should ke kept secret in a file named ".env" file which is ignored by .gitignore//
therefore install a package named "environ" via "pip install environ" command on CLI to read
the contents of .env file.
In the same directory of settings.py create a file named ".env" and then put your secret key there
and all the other sensitive passwords which an attacker might misuse such as creating own hashes for website using
secret key.
Also DEBUG should be kept false during production


CONTENTS OF .env file should look like:

SECRET_KEY=xyz
DEBUG=FALSE

(remember not to use any space across equals-to("==") sign and also write everything without quotes)
Empty file removed apis/migrations/__init__.py
Empty file.
Binary file removed db.sqlite3
Binary file not shown.
Binary file removed info/__pycache__/__init__.cpython-36.pyc
Binary file not shown.
Binary file removed info/__pycache__/__init__.cpython-37.pyc
Binary file not shown.
Binary file removed info/__pycache__/admin.cpython-36.pyc
Binary file not shown.
Binary file removed info/__pycache__/admin.cpython-37.pyc
Binary file not shown.
Binary file removed info/__pycache__/apps.cpython-36.pyc
Binary file not shown.
Binary file removed info/__pycache__/apps.cpython-37.pyc
Binary file not shown.
5 changes: 0 additions & 5 deletions info/__pycache__/desktop.ini

This file was deleted.

Binary file removed info/__pycache__/models.cpython-36.pyc
Binary file not shown.
Binary file removed info/__pycache__/models.cpython-37.pyc
Binary file not shown.
Binary file removed info/__pycache__/tests.cpython-36.pyc
Binary file not shown.
Binary file removed info/__pycache__/tests.cpython-37.pyc
Binary file not shown.
Binary file removed info/__pycache__/urls.cpython-36.pyc
Binary file not shown.
Binary file removed info/__pycache__/urls.cpython-37.pyc
Binary file not shown.
Binary file removed info/__pycache__/views.cpython-36.pyc
Binary file not shown.
Binary file removed info/__pycache__/views.cpython-37.pyc
Binary file not shown.
188 changes: 98 additions & 90 deletions info/migrations/0001_initial.py

Large diffs are not rendered by default.

23 changes: 0 additions & 23 deletions info/migrations/0002_auto_20181109_1947.py

This file was deleted.

17 changes: 0 additions & 17 deletions info/migrations/0003_auto_20181109_2003.py

This file was deleted.

30 changes: 0 additions & 30 deletions info/migrations/0004_auto_20181109_2013.py

This file was deleted.

17 changes: 0 additions & 17 deletions info/migrations/0005_auto_20181109_2024.py

This file was deleted.

20 changes: 0 additions & 20 deletions info/migrations/0006_teacher_user.py

This file was deleted.

18 changes: 0 additions & 18 deletions info/migrations/0007_auto_20181109_2238.py

This file was deleted.

17 changes: 0 additions & 17 deletions info/migrations/0008_auto_20181111_1107.py

This file was deleted.

17 changes: 0 additions & 17 deletions info/migrations/0009_auto_20181111_1112.py

This file was deleted.

18 changes: 0 additions & 18 deletions info/migrations/0010_auto_20181111_1218.py

This file was deleted.

17 changes: 0 additions & 17 deletions info/migrations/0011_auto_20181111_2017.py

This file was deleted.

18 changes: 0 additions & 18 deletions info/migrations/0012_auto_20181111_2018.py

This file was deleted.

19 changes: 0 additions & 19 deletions info/migrations/0013_auto_20181112_1846.py

This file was deleted.

18 changes: 0 additions & 18 deletions info/migrations/0014_auto_20201028_2022.py

This file was deleted.

21 changes: 0 additions & 21 deletions info/migrations/0015_attendancerange.py

This file was deleted.

22 changes: 0 additions & 22 deletions info/migrations/0016_auto_20210820_1553.py

This file was deleted.

Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file removed info/migrations/__pycache__/__init__.cpython-36.pyc
Binary file not shown.
Binary file removed info/migrations/__pycache__/__init__.cpython-37.pyc
Binary file not shown.
Loading