@@ -29,7 +29,7 @@ Note: setting allowed networks to 0.0.0.0/0 opens your SQL instance to traffic f
29
29
* Alternatively, the instance can be created with the gcloud command line tool as follows, substituting `your-root-pw
30
30
with a strong, unique password.
31
31
32
- ` gcloud sql instances create <instance_name> --assign-ip --authorized-networks=0.0.0.0/0 set-root-password=your-root-pw`
32
+ gcloud sql instances create <instance_name> --assign-ip --authorized-networks=0.0.0.0/0 set-root-password=your-root-pw
33
33
34
34
* Create a Database And User
35
35
@@ -51,23 +51,21 @@ First make sure you have Django installed. It's recommended you do so in a
51
51
[ virtualenv] ( https://virtualenv.pypa.io/en/latest/ ) . The requirements.txt
52
52
contains just the Django dependency.
53
53
54
- ` pip install -r requirements.txt `
54
+ pip install -r requirements.txt
55
55
56
56
Once the database is setup, run the migrations.
57
57
58
- ` python manage.py migrate `
58
+ python manage.py migrate
59
59
60
60
If you'd like to use the admin console, create a superuser.
61
61
62
- ` python manage.py createsuperuser `
62
+ python manage.py createsuperuser
63
63
64
64
The app can be run locally the same way as any other Django app.
65
65
66
- ` python manage.py runserver `
66
+ python manage.py runserver
67
67
68
- Now you can view the admin panel of your local site at
69
-
70
- ` http://localhost:8080/admin `
68
+ Now you can view the admin panel of your local site at http://localhost:8080/admin
71
69
72
70
## Deploying
73
71
@@ -76,33 +74,31 @@ the static content is instead served from Google Cloud Storage.
76
74
77
75
First, make a bucket and make it publically readable, replacing <your-gcs-bucket > with a bucket name, such as your project id:
78
76
79
- ` gsutil mb gs://<your-gcs-bucket>`
80
- ` gsutil defacl set public-read gs://<your-gcs-bucket>`
77
+ gsutil mb gs://<your-gcs-bucket>
78
+ gsutil defacl set public-read gs://<your-gcs-bucket>
81
79
82
80
Next, gather all the static content locally into one folder using the Django ` collectstatic ` command
83
81
84
- ` python manage.py collectstatic`
82
+ python manage.py collectstatic
85
83
86
84
Then upload it to CloudStorage using the ` gsutil rsync ` command
87
85
88
- ` gsutil rsync -R static/ gs://<your-gcs-bucket>/static`
86
+ gsutil rsync -R static/ gs://<your-gcs-bucket>/static
89
87
90
88
Now your static content can be served from the following URL:
91
89
92
- ` http://storage.googleapis.com/<your-gcs-bucket/static/`
90
+ http://storage.googleapis.com/<your-gcs-bucket/static/
93
91
94
92
Make sure to replace <your-cloud-bucket > within ` mysite/settings.py ` to set STATIC_URL to the correct value to serve static content from, and
95
93
uncomment the STATIC_URL to point to the new URL.
96
94
97
95
The app can be deployed by running
98
96
99
- ` gcloud preview app deploy app.yaml --set-default --version=1 --promote`
97
+ gcloud app deploy
100
98
101
99
which deploys to version 1, and ` promote ` makes version 1 the default version.
102
100
103
- Now you can view the admin panel of your deployed site at
104
-
105
- ` https://<your-app-id>.appspot.com/admin `
101
+ Now you can view the admin panel of your deployed site at https://<your-app-id >.appspot.com/admin.
106
102
107
103
## Contributing changes
108
104
0 commit comments