@@ -120,11 +120,20 @@ ALLOWED_HOSTS = ['127.0.0.1', '.pythonanywhere.com']
120120
121121> If you are hosting your project on ` Glitch.com ` , let us protect the Django secret key that needs to
122122> remain confidential (otherwise, anyone remixing your project could see it) :
123- > * Create a file ``` .env ``` at the root of your project and add the following property in it :
123+ > * First, we are going to create a random secret key. Open the Glitch terminal again, and type the following command :
124124> {% filename %}.env{% endfilename %}
125125> ``` bash
126- > # Remember to change the value below to any, very long, very random sequence of characters
127- > SECRET=' a-completely-random-string-of-letters-numbers-and-special-characters-anything-goes'
126+ > python -c ' from django.core.management.utils import get_random_secret_key; \
127+ > print(get_random_secret_key())'
128+ > ` ` `
129+ > This should display a long random string, perfect to use a secret key for your brand new Django web site.
130+ > We will now paste this key into a ` .env` file that Glitch will only show you if you are the owner of the web site.
131+ >
132+ > * Create a file ` .env` at the root of your project and add the following property in it :
133+ > {% filename %}.env{% endfilename %}
134+ > ` ` ` bash
135+ > # Here, inside the single quotes, you can cut and paste the random key generated above
136+ > SECRET='3!0k#7ds5mp^-x$lqs2%le6v97h#@xopab&oj5y7d=hxe511jl'
128137> ` ` `
129138> * Then update the Django settings file to inject this secret value and set the Django web site name :
130139> {% filename %}mysite/settings.py{% endfilename %}
0 commit comments