diff --git a/.envsample b/.envsample deleted file mode 100644 index 08e49d0..0000000 --- a/.envsample +++ /dev/null @@ -1 +0,0 @@ -SECRET_KEY = VULCANWEBKEY diff --git a/README.md b/README.md index e05ea0b..89cc2d1 100644 --- a/README.md +++ b/README.md @@ -25,12 +25,7 @@ And in frontend: ```shell npm install ``` -## 2. Create .env and make migrations -In the .env file put the code: -```shell -SECRET_KEY = VULCANWEBKEY -``` -After saving the files, we migrate with these commands: +## 2. Make migrations ```shell python manage.py makemigrations python manage.py migrate diff --git a/batch/install.bat b/batch/install.bat index 3eb3d30..f6b3cb0 100644 --- a/batch/install.bat +++ b/batch/install.bat @@ -1,29 +1,5 @@ ::To jest to samo co w pliku install.exe pip install -r requirements.txt -echo SECRET_KEY = VULCANWEBKEY > .env -::Kiedyś to SECRET_KEY będzie generowany przez skrypt NIE RUSZAĆ!!! -::setLocal EnableDelayedExpansion -::set str=ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890 -::set /a P=!random!%%36 -::set znak1=!str:~%P%,1! -::set /a P=!random!%%36 -::set znak2=!str:~%P%,1! -::set /a P=!random!%%36 -::set znak3=!str:~%P%,1! -::set /a P=!random!%%36 -::set znak4=!str:~%P%,1! -::set /a P=!random!%%36 -::set znak5=!str:~%P%,1! -::set /a P=!random!%%36 -::set znak6=!str:~%P%,1! -::set /a P=!random!%%36 -::set znak7=!str:~%P%,1! -::set /a P=!random!%%36 -::set znak8=!str:~%P%,1! -::set /a P=!random!%%36 -::set znak9=!str:~%P%,1! -::set "key=%znak1%%znak2%%znak3%%znak4%%znak5%%znak6%%znak7%%znak8%%znak9%" -::echo SECRET_KEY = %key% > .env python manage.py makemigrations python manage.py migrate npm install diff --git a/install.exe b/install.exe index f58b265..d6403a9 100644 Binary files a/install.exe and b/install.exe differ diff --git a/requirements.txt b/requirements.txt index e1abe1e..6bbeba5 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,6 +1,5 @@ beautifulsoup4==4.9.3 bs4==0.0.1 Django==3.1.3 -python-dotenv==0.15.0 requests==2.24.0 cryptography==3.2.1 \ No newline at end of file diff --git a/wulkanowy/settings.py b/wulkanowy/settings.py index e27fd66..36d57bc 100644 --- a/wulkanowy/settings.py +++ b/wulkanowy/settings.py @@ -12,7 +12,7 @@ https://docs.djangoproject.com/en/3.1/ref/settings/ from pathlib import Path import os -import dotenv +from cryptography.fernet import Fernet ROOT_PATH = os.path.dirname(__file__) # Build paths inside the project like this: BASE_DIR / 'subdir'. @@ -22,11 +22,7 @@ BASE_DIR = Path(__file__).resolve().parent.parent # Quick-start development settings - unsuitable for production # See https://docs.djangoproject.com/en/3.1/howto/deployment/checklist/ -dotenv_file = os.path.join(BASE_DIR, ".env") -if os.path.isfile(dotenv_file): - dotenv.load_dotenv(dotenv_file) - -SECRET_KEY = os.environ['SECRET_KEY'] # Instead of your actual secret key +SECRET_KEY = Fernet.generate_key().decode('utf-8') # SECURITY WARNING: don't run with debug turned on in production! DEBUG = True