Django’da ortam dosyalarını kullanmak

pip3 install virtualenv
virtualenv myvenv
source myvenv/bin/activate
pip install Django
django-admin startproject envsample
cd envsample
python manage.py runserver
Watching for file changes with StatReloader
Performing system checks...
System check identified no issues (0 silenced).You have 18 unapplied migration(s). Your project may not work properly until you apply the migrations for app(s): admin, auth, contenttypes, sessions.
Run 'python manage.py migrate' to apply them.
February 14, 2021 - 13:20:01
Django version 3.1.6, using settings 'envsample.settings'
Starting development server at <http://127.0.0.1:8000/>
Quit the server with CONTROL-C.
# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = 'n9^y4)ui^w+aw_7-bm6add5re09_#7zn0m5gqy_(btd*w3^9#w'
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': BASE_DIR / 'db.sqlite3',
}
}
DATABASES = {
"default": {
"ENGINE": "django.db.backends.postgresql_psycopg2",
"NAME": "testdb",
"USER": "testuser",
"PASSWORD": "1234",
"HOST": "localhost",
"PORT": "5432",
}
}
EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'
EMAIL_HOST = 'smtp.gmail.com'
EMAIL_PORT = 587
EMAIL_USE_TLS = True
EMAIL_HOST_USER = "examplemail@gmail.com"
EMAIL_HOST_PASSWORD = "123456"
pip install python-dotenv
SECRET_KEY='n9^y4)ui^w+aw_7-bm6add5re09_#7zn0m5gqy_(btd*w3^9#w'
DB_NAME='testdb'
DB_USER='testuser'
DB_PASSWORD='1234'
EMAIL_USER = "examplemail@gmail.com"
EMAIL_PASSWORD = "123456"
import os
from dotenv import load_dotenv
load_dotenv()
SECRET_KEY = os.getenv("SECRET_KEY")DATABASES = {
"default": {
"ENGINE": "django.db.backends.postgresql_psycopg2",
"NAME": os.getenv("DB_NAME"),
"USER": os.getenv("DB_USER"),
"PASSWORD": os.getenv("DB_PASSWORD"),
"HOST": "localhost",
"PORT": "5432",
}
}
EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'
EMAIL_HOST = 'smtp.gmail.com'
EMAIL_PORT = 587
EMAIL_USE_TLS = True
EMAIL_HOST_USER = os.getenv("EMAIL_USER")
EMAIL_HOST_PASSWORD = os.getenv("EMAIL_PASSWORD")
SECRET_KEY='your_django_secret_key'
DB_NAME='your_database_name'
DB_USER='your_database_admin_user'
DB_PASSWORD='your_database_admin_password'
EMAIL_USER = "your_email_user"
EMAIL_PASSWORD = "your_email_password"

--

--

📜 kurmacakafa. fictionhead. blue 🎥 film. code. creative arts. 🎬 filmmaker. developer. entrepreneur. 📌 Parazit Film & Digital Workz. Kısa İyidir. Tabby Cat.

Love podcasts or audiobooks? Learn on the go with our new app.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Heval Hazal Kurt

Heval Hazal Kurt

📜 kurmacakafa. fictionhead. blue 🎥 film. code. creative arts. 🎬 filmmaker. developer. entrepreneur. 📌 Parazit Film & Digital Workz. Kısa İyidir. Tabby Cat.