mirror of
https://github.com/cookiecutter/cookiecutter-django.git
synced 2025-08-15 17:34:52 +03:00
Replace 0.0.0.0 with 127.0.0.1.
This commit is contained in:
parent
3b0b87e4cb
commit
bf9daec084
|
@ -208,17 +208,17 @@ Increasingly it is becoming necessary to develop software in a secure environmen
|
|||
On order to create a secure environment, we need to have a trusted SSL certficate installed in our Docker application.
|
||||
|
||||
#. **Let's Encrypt**
|
||||
|
||||
The official line from Let’s Encrypt is:
|
||||
|
||||
[For local development section] ... The best option: Generate your own certificate, either self-signed or signed by a local root, and trust it in your operating system’s trust store. Then use that certificate in your local web server. See below for details.
|
||||
The official line from Let’s Encrypt is:
|
||||
|
||||
[For local development section] ... The best option: Generate your own certificate, either self-signed or signed by a local root, and trust it in your operating system’s trust store. Then use that certificate in your local web server. See below for details.
|
||||
|
||||
See `letsencrypt.org - certificates-for-localhost`_
|
||||
|
||||
.. _`letsencrypt.org - certificates-for-localhost`: https://letsencrypt.org/docs/certificates-for-localhost/
|
||||
|
||||
#. **mkcert: Valid Https Certificates For Localhost**
|
||||
|
||||
|
||||
`mkcert`_ is a simple by design tool that hides all the arcane knowledge required to generate valid TLS certificates. It works for any hostname or IP, including localhost. It supports macOS, Linux, and Windows, and Firefox, Chrome and Java. It even works on mobile devices with a couple manual steps.
|
||||
|
||||
See https://blog.filippo.io/mkcert-valid-https-certificates-for-localhost/
|
||||
|
@ -253,11 +253,11 @@ local.yml
|
|||
restart: always
|
||||
depends_on:
|
||||
- django
|
||||
|
||||
|
||||
...
|
||||
|
||||
#. Link the ``nginx-proxy`` to ``django`` through environmental variables.
|
||||
|
||||
|
||||
``django`` already has an ``.env`` file connected to it. Add the following variables. You should do this especially if you are working with a team and you want to keep your local environment details to yourself.
|
||||
|
||||
::
|
||||
|
@ -274,7 +274,7 @@ config/settings/local.py
|
|||
|
||||
You should allow the new hostname. ::
|
||||
|
||||
ALLOWED_HOSTS = ["localhost", "0.0.0.0", "127.0.0.1", "my-dev-env.local"]
|
||||
ALLOWED_HOSTS = ["localhost", "127.0.0.1", "my-dev-env.local"]
|
||||
|
||||
Rebuild your ``docker`` application. ::
|
||||
|
||||
|
|
|
@ -76,11 +76,11 @@ First things first.
|
|||
|
||||
#. If you're running synchronously, see the application being served through Django development server: ::
|
||||
|
||||
$ python manage.py runserver 0.0.0.0:8000
|
||||
$ python manage.py runserver 127.0.0.1:8000
|
||||
|
||||
or if you're running asynchronously: ::
|
||||
|
||||
$ uvicorn config.asgi:application --host 0.0.0.0 --reload
|
||||
$ uvicorn config.asgi:application --host 127.0.0.1 --reload
|
||||
|
||||
.. _PostgreSQL: https://www.postgresql.org/download/
|
||||
.. _Redis: https://redis.io/download
|
||||
|
|
|
@ -7,7 +7,7 @@ set -o nounset
|
|||
|
||||
python manage.py migrate
|
||||
{%- if cookiecutter.use_async == 'y' %}
|
||||
uvicorn config.asgi:application --host 0.0.0.0 --reload
|
||||
uvicorn config.asgi:application --host 127.0.0.1 --reload
|
||||
{%- else %}
|
||||
python manage.py runserver_plus 0.0.0.0:8000
|
||||
python manage.py runserver_plus 127.0.0.1:8000
|
||||
{% endif %}
|
||||
|
|
|
@ -28,7 +28,7 @@ if compress_enabled; then
|
|||
fi
|
||||
{%- endif %}
|
||||
{% if cookiecutter.use_async == 'y' %}
|
||||
/usr/local/bin/gunicorn config.asgi --bind 0.0.0.0:5000 --chdir=/app -k uvicorn.workers.UvicornWorker
|
||||
/usr/local/bin/gunicorn config.asgi --bind 127.0.0.1:5000 --chdir=/app -k uvicorn.workers.UvicornWorker
|
||||
{% else %}
|
||||
/usr/local/bin/gunicorn config.wsgi --bind 0.0.0.0:5000 --chdir=/app
|
||||
/usr/local/bin/gunicorn config.wsgi --bind 127.0.0.1:5000 --chdir=/app
|
||||
{%- endif %}
|
||||
|
|
|
@ -11,7 +11,7 @@ SECRET_KEY = env(
|
|||
default="!!!SET DJANGO_SECRET_KEY!!!",
|
||||
)
|
||||
# https://docs.djangoproject.com/en/dev/ref/settings/#allowed-hosts
|
||||
ALLOWED_HOSTS = ["localhost", "0.0.0.0", "127.0.0.1"]
|
||||
ALLOWED_HOSTS = ["localhost", "127.0.0.1"]
|
||||
|
||||
# CACHES
|
||||
# ------------------------------------------------------------------------------
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
|
||||
# You can set these variables from the command line, and also
|
||||
# from the environment for the first two.
|
||||
SPHINXOPTS ?=
|
||||
SPHINXOPTS ?=
|
||||
SPHINXBUILD ?= sphinx-build -c .
|
||||
SOURCEDIR = .
|
||||
BUILDDIR = ./_build
|
||||
|
@ -21,9 +21,9 @@ help:
|
|||
|
||||
# Build, watch and serve docs with live reload
|
||||
livehtml:
|
||||
sphinx-autobuild -b html
|
||||
{%- if cookiecutter.use_docker == 'y' %} --host 0.0.0.0
|
||||
{%- else %} --open-browser
|
||||
sphinx-autobuild -b html
|
||||
{%- if cookiecutter.use_docker == 'y' %} --host 127.0.0.1
|
||||
{%- else %} --open-browser
|
||||
{%- endif %} --port 7000 --watch $(APP) -c . $(SOURCEDIR) $(BUILDDIR)/html
|
||||
|
||||
# Outputs rst files from django application code
|
||||
|
|
|
@ -40,10 +40,10 @@ services:
|
|||
volumes:
|
||||
- production_traefik:/etc/traefik/acme:z
|
||||
ports:
|
||||
- "0.0.0.0:80:80"
|
||||
- "0.0.0.0:443:443"
|
||||
- "80:80"
|
||||
- "443:443"
|
||||
{%- if cookiecutter.use_celery == 'y' %}
|
||||
- "0.0.0.0:5555:5555"
|
||||
- "5555:5555"
|
||||
{%- endif %}
|
||||
|
||||
redis:
|
||||
|
|
Loading…
Reference in New Issue
Block a user