-
Notifications
You must be signed in to change notification settings - Fork 0
/
video5.txt
61 lines (58 loc) · 2.05 KB
/
video5.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
CORS
pip install django-cors-headers
settings > installed apps > 'corsheaders',
settings > MIDDLEWARE
'corsheaders.middleware.CorsMiddleware',
'django.middleware.common.CommonMiddleware',
settings >
CORS_ALLOWED_ORIGINS = [
"https://example.com",
"https://sub.example.com",
"http://localhost:8080",
"http://127.0.0.1:9000"
]
Heroku > Create new App > marketplace-online
* brew tap heroku/brew && brew install heroku >> macos
* heroku login
* pip install python-decouple
* Decouple the env
settings > from decouple import config
.env >
SECRET_KEY =sjdhsajdghsaidgsaidg
settings > SECRET_KEY = config('SECRET_KEY')
.env & settings >> DEBUG
* Django DB URL
pip install dj-database-url
settings > from dj_database_url import parse as dburl
settings >
import os
default_dburl = 'sqlite:///' + os.path.join(BASE_DIR, 'db.sqlite3')
DATABASES = {
'default': config('DATABASE_URL', default=default_dburl, cast=dburl),
}
* Django static
pip install dj-static
wsgi.py >
from dj_static import Cling
application = Cling(get_wsgi_application())
settings >
STATIC_ROOT = os.path.join(BASE_DIR, 'statics')
* pip freeze > requirements_local.txt
touch requirements.txt
-r requirements_local.txt
gunicorn
psycopg2
* touch Procfile
Procfile >
web: gunicorn Ecommerce.wsgi --log-file -
* touch runtime.txt
runtime >
python-3.8.5
* allowed hosts @settings
ALLOWED_HOSTS = ['127.0.0.1','.localhost', 'marketplace-online.herokuapp.com]
* remove the .env from .ignore
* deploy code to heroku >> use git automatice after push
* after deploy
heroku git:remote -a mobilerater => heroku git:remote -a heroku_project_name
heroku run python3 manage.py migrate
heroku run python3 manage.py createsuperuser