This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$pip install mysqlclient | |
$python manage.py inspectdb > employee_app/models.py |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
def env_var(name): | |
'''gets the environment variables''' | |
try: | |
return str(os.environ[name]) | |
except: | |
raise KeyError | |
DATABASES = { | |
'default': { | |
'ENGINE': 'django.db.backends.mysql', |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$DB_PASS='mypassword' | |
$export DB_PASS |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--ساخت دیتابیس در شاخه root پروژه. من پایگاه داده ام رو با یوزر root اجرا می کنم. شما می تونید از کاربرای دیگه استفاده کنید | |
$mysql -u 'root' < "employees.sql" -p |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--Virtual Environment | |
$sudo apt install python3-venv python3-pip | |
$python3 -m venv “/path to your location folder” | |
--activate the virtual environment | |
$ source <location folder>/bin/activate | |
--install latest django version | |
$pip install django | |
$pip install djangorestframework | |
---start django project and app. | |
$django-admin startproject backend |
NewerOlder