Skip to content

Commit 0c60324

Browse files
author
yangxg
committed
Step17: deploy automatically with fabric
1 parent 536031d commit 0c60324

File tree

14 files changed

+253
-17
lines changed

14 files changed

+253
-17
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,7 @@ venv.bak/
105105
# mypy
106106
*.sqlite3
107107
media/
108+
_credentials.py
108109

109110
# Pycharm .idea folder, see following link to know which files should be ignored:
110111
# https://www.jetbrains.com/help/pycharm/synchronizing-and-sharing-settings.html#7e81d3cb

.idea/django-blog-tutorial-v2.iml

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Pipfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ url = "https://pypi.org/simple"
44
verify_ssl = true
55

66
[dev-packages]
7+
fabric = "*"
78

89
[packages]
910
django = "*"

Pipfile.lock

Lines changed: 145 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# Generated by Django 2.2.5 on 2019-10-11 15:26
2+
3+
from django.db import migrations
4+
5+
6+
class Migration(migrations.Migration):
7+
8+
dependencies = [
9+
('blog', '0002_auto_20190711_1802'),
10+
]
11+
12+
operations = [
13+
migrations.AlterModelOptions(
14+
name='post',
15+
options={'ordering': ['-created_time'], 'verbose_name': '文章', 'verbose_name_plural': '文章'},
16+
),
17+
]

blogproject/settings/__init__.py

Whitespace-only changes.

blogproject/settings.py renamed to blogproject/settings/common.py

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -13,19 +13,13 @@
1313
import os
1414

1515
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
16-
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
16+
back = os.path.dirname
17+
18+
BASE_DIR = back(back(back(os.path.abspath(__file__))))
1719

1820
# Quick-start development settings - unsuitable for production
1921
# See https://docs.djangoproject.com/en/2.2/howto/deployment/checklist/
2022

21-
# SECURITY WARNING: keep the secret key used in production secret!
22-
SECRET_KEY = 'mz_y+z%o-5bk%-$urn+xj6v5!e)!^yzj&fs)j1@&p$@h!rzq&h'
23-
24-
# SECURITY WARNING: don't run with debug turned on in production!
25-
DEBUG = False
26-
27-
ALLOWED_HOSTS = ['127.0.0.1', 'localhost', '149.129.53.245', '.zmrenwu.com']
28-
2923
# Application definition
3024

3125
INSTALLED_APPS = [

blogproject/settings/local.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
from .common import *
2+
3+
SECRET_KEY = 'development-secret-key'
4+
5+
DEBUG = True
6+
7+
ALLOWED_HOSTS = ['*']

blogproject/settings/production.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
from .common import *
2+
3+
SECRET_KEY = os.environ['DJANGO_SECRET_KEY']
4+
5+
DEBUG = False
6+
7+
ALLOWED_HOSTS = ['hellodjango-blog-tutorial-demo.zmrenwu.com']

blogproject/wsgi.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,6 @@
1111

1212
from django.core.wsgi import get_wsgi_application
1313

14-
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'blogproject.settings')
14+
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'blogproject.settings.production')
1515

1616
application = get_wsgi_application()

0 commit comments

Comments
 (0)