{
    "componentChunkName": "component---src-pages-blog-post-tsx",
    "path": "/blog/2021-01-14/django-docker-tutorial",
    "result": {"data":{"site":{"siteMetadata":{"siteUrl":"https://www.architect.io"}},"allMdx":{"edges":[{"node":{"body":"var _excluded = [\"components\"];\n\nfunction _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }\n\nfunction _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }\n\nfunction _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }\n\n/* @jsxRuntime classic */\n\n/* @jsx mdx */\nvar _frontmatter = {\n  \"title\": \"Deploy your Django app with Docker\",\n  \"description\": \"Follow our guide to deploy a Django app safely and securely on your local machine via Docker, so you can launch to the cloud with confidence.\",\n  \"keywords\": \"django docker deployment\",\n  \"slug\": \"django-docker-tutorial\",\n  \"date\": \"2021-01-14T00:00:00.000Z\",\n  \"author\": \"TJ Higgins\",\n  \"image\": \"./deploy-django-app-docker.png\"\n};\nvar layoutProps = {\n  _frontmatter: _frontmatter\n};\nvar MDXLayout = \"wrapper\";\nreturn function MDXContent(_ref) {\n  var components = _ref.components,\n      props = _objectWithoutProperties(_ref, _excluded);\n\n  return mdx(MDXLayout, _extends({}, layoutProps, props, {\n    components: components,\n    mdxType: \"MDXLayout\"\n  }), mdx(\"p\", null, \"Django is an excellent Python Web framework, but it can be tricky to deploy to the cloud. If you\\u2019re\\nbuilding in Python, you want the confidence that what you develop and deploy locally will translate\\nto production. This quick-start guide demonstrates how to set up and run a simple Django/PostgreSQL\\napp locally for development and production-ready in the cloud.\"), mdx(\"h2\", {\n    \"id\": \"prerequisites\",\n    \"style\": {\n      \"position\": \"relative\"\n    }\n  }, \"Prerequisites\", mdx(\"a\", {\n    parentName: \"h2\",\n    \"href\": \"#prerequisites\",\n    \"aria-label\": \"prerequisites permalink\",\n    \"className\": \"anchor after\"\n  }, mdx(\"svg\", {\n    parentName: \"a\",\n    \"aria-hidden\": \"true\",\n    \"focusable\": \"false\",\n    \"height\": \"16\",\n    \"version\": \"1.1\",\n    \"viewBox\": \"0 0 16 16\",\n    \"width\": \"16\"\n  }, mdx(\"path\", {\n    parentName: \"svg\",\n    \"fillRule\": \"evenodd\",\n    \"d\": \"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"\n  })))), mdx(\"p\", null, \"There are many tools out there that provide support for local development OR remote deployment.\\nArchitect was built to do both. This tutorial will show how, with one simple \", mdx(\"inlineCode\", {\n    parentName: \"p\"\n  }, \"architect.yml\"), \" file,\\nany developer can run their application locally and in the cloud without having to learn/write\\ndocker-compose and infrastructure as code templates.\"), mdx(\"p\", null, \"Before you begin, make sure the following are installed on your system:\"), mdx(\"p\", null, mdx(\"strong\", {\n    parentName: \"p\"\n  }, \"Architect CLI:\"), \" The best way to install the CLI is via NPM:\"), mdx(\"div\", {\n    \"className\": \"gatsby-highlight\",\n    \"data-language\": \"console\"\n  }, mdx(\"pre\", {\n    parentName: \"div\",\n    \"className\": \"language-console\"\n  }, mdx(\"code\", {\n    parentName: \"pre\",\n    \"className\": \"language-console\"\n  }, \"$ npm install -g @architect-io/cli\"))), mdx(\"p\", null, \"Alternatively, you can download the binary for your system architecture from Github. Just download\\nthe appropriate bundle, extract it, and link the included bin folder to your user home directory.\"), mdx(\"p\", null, mdx(\"strong\", {\n    parentName: \"p\"\n  }, \"Docker:\"), \" This is a software platform for building applications based on containers. Install it\\naccording to \", mdx(\"a\", {\n    parentName: \"p\",\n    \"href\": \"https://www.docker.com/get-started\"\n  }, \"the docs on their site\"), \".\"), mdx(\"h2\", {\n    \"id\": \"django-docker-and-more\",\n    \"style\": {\n      \"position\": \"relative\"\n    }\n  }, \"Django, Docker, and more\", mdx(\"a\", {\n    parentName: \"h2\",\n    \"href\": \"#django-docker-and-more\",\n    \"aria-label\": \"django docker and more permalink\",\n    \"className\": \"anchor after\"\n  }, mdx(\"svg\", {\n    parentName: \"a\",\n    \"aria-hidden\": \"true\",\n    \"focusable\": \"false\",\n    \"height\": \"16\",\n    \"version\": \"1.1\",\n    \"viewBox\": \"0 0 16 16\",\n    \"width\": \"16\"\n  }, mdx(\"path\", {\n    parentName: \"svg\",\n    \"fillRule\": \"evenodd\",\n    \"d\": \"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"\n  })))), mdx(\"p\", null, \"For this project, you need to create a Dockerfile, a Python dependencies file, and an\\n\", mdx(\"inlineCode\", {\n    parentName: \"p\"\n  }, \"architect.yml\"), \" file.\"), mdx(\"p\", null, \"Create an empty project directory. You can name the directory something easy for you to remember.\\nThis directory is the context for your application image. The directory should only contain\\nresources to build that image.\"), mdx(\"p\", null, \"You\\u2019ll next need to create a new file called \", mdx(\"inlineCode\", {\n    parentName: \"p\"\n  }, \"Dockerfile\"), \" in your project directory. The Dockerfile\\ndefines an application's image content via one or more build commands that configure that image.\\nOnce built, you can run the image in a container.\"), mdx(\"p\", null, \"Add the following content to the \", mdx(\"inlineCode\", {\n    parentName: \"p\"\n  }, \"Dockerfile\"), \":\"), mdx(\"div\", {\n    \"className\": \"gatsby-highlight\",\n    \"data-language\": \"dockerfile\"\n  }, mdx(\"pre\", {\n    parentName: \"div\",\n    \"className\": \"language-dockerfile\"\n  }, mdx(\"code\", {\n    parentName: \"pre\",\n    \"className\": \"language-dockerfile\"\n  }, mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token instruction\"\n  }, mdx(\"span\", {\n    parentName: \"span\",\n    \"className\": \"token keyword\"\n  }, \"FROM\"), \" python:3\"), \"\\n\", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token instruction\"\n  }, mdx(\"span\", {\n    parentName: \"span\",\n    \"className\": \"token keyword\"\n  }, \"ENV\"), \" PYTHONUNBUFFERED=1\"), \"\\n\", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token instruction\"\n  }, mdx(\"span\", {\n    parentName: \"span\",\n    \"className\": \"token keyword\"\n  }, \"WORKDIR\"), \" /code\"), \"\\n\", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token instruction\"\n  }, mdx(\"span\", {\n    parentName: \"span\",\n    \"className\": \"token keyword\"\n  }, \"COPY\"), \" requirements.txt /code/\"), \"\\n\", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token instruction\"\n  }, mdx(\"span\", {\n    parentName: \"span\",\n    \"className\": \"token keyword\"\n  }, \"RUN\"), \" pip install -r requirements.txt\"), \"\\n\", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token instruction\"\n  }, mdx(\"span\", {\n    parentName: \"span\",\n    \"className\": \"token keyword\"\n  }, \"COPY\"), \" . /code/\")))), mdx(\"p\", null, \"Create a \", mdx(\"inlineCode\", {\n    parentName: \"p\"\n  }, \"requirements.txt\"), \" in your project directory. This file is used by the\\n\", mdx(\"inlineCode\", {\n    parentName: \"p\"\n  }, \"RUN pip install -r requirements.txt\"), \" command in your \", mdx(\"inlineCode\", {\n    parentName: \"p\"\n  }, \"Dockerfile\"), \". Pip is a package-management\\nsystem similar to npm except for Python. Each line in the file represents an external dependency and\\nthe required version of that software.\"), mdx(\"p\", null, \"Add the required software in the file.\"), mdx(\"div\", {\n    \"className\": \"gatsby-highlight\",\n    \"data-language\": \"text\"\n  }, mdx(\"pre\", {\n    parentName: \"div\",\n    \"className\": \"language-text\"\n  }, mdx(\"code\", {\n    parentName: \"pre\",\n    \"className\": \"language-text\"\n  }, \"Django>=3.0,<4.0\\npsycopg2-binary>=2.8\\nuwsgi>=2.0\"))), mdx(\"p\", null, \"Create a file called \", mdx(\"inlineCode\", {\n    parentName: \"p\"\n  }, \"architect.yml\"), \" in your project directory. The \", mdx(\"inlineCode\", {\n    parentName: \"p\"\n  }, \"architect.yml\"), \" file describes\\nthe services that make your app. In this example, those services are a web server and database. Add\\nthe following configuration to the file:\"), mdx(\"div\", {\n    \"className\": \"gatsby-highlight\",\n    \"data-language\": \"yaml\"\n  }, mdx(\"pre\", {\n    parentName: \"div\",\n    \"className\": \"language-yaml\"\n  }, mdx(\"code\", {\n    parentName: \"pre\",\n    \"className\": \"language-yaml\"\n  }, mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token key atrule\"\n  }, \"name\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \":\"), \" examples/django\\n\", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token key atrule\"\n  }, \"parameters\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \":\"), \"\\n  \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token key atrule\"\n  }, \"django_secret_key\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \":\"), \"\\n    \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token key atrule\"\n  }, \"default\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \":\"), \" warning\", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \"-\"), \"override\", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \"-\"), \"for\", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \"-\"), \"production\\n  \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token key atrule\"\n  }, \"postgres_password\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \":\"), \"\\n    \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token key atrule\"\n  }, \"default\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \":\"), \" warning\", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \"-\"), \"override\", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \"-\"), \"for\", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \"-\"), \"production\\n\\n\", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token key atrule\"\n  }, \"services\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \":\"), \"\\n  \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token key atrule\"\n  }, \"db\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \":\"), \"\\n    \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token key atrule\"\n  }, \"image\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \":\"), \" postgres\\n    \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token key atrule\"\n  }, \"interfaces\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \":\"), \"\\n      \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token key atrule\"\n  }, \"main\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \":\"), \" \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token number\"\n  }, \"5432\"), \"\\n    \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token key atrule\"\n  }, \"environment\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \":\"), \"\\n      \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token key atrule\"\n  }, \"POSTGRES_DB\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \":\"), \" postgres\\n      \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token key atrule\"\n  }, \"POSTGRES_USER\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \":\"), \" postgres\\n      \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token key atrule\"\n  }, \"POSTGRES_PASSWORD\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \":\"), \" $\", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \"{\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \"{\"), \" parameters.postgres_password \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \"}\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \"}\"), \"\\n  \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token key atrule\"\n  }, \"web\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \":\"), \"\\n    \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token key atrule\"\n  }, \"build\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \":\"), \"\\n      \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token key atrule\"\n  }, \"context\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \":\"), \" .\\n    \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token key atrule\"\n  }, \"command\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \":\"), \" \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \"|\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token scalar string\"\n  }, \"\\n      sh -c '\\n        python manage.py collectstatic --noinput\\n        python manage.py migrate --noinput\\n        uwsgi --http \\\"0.0.0.0:8000\\\" --module architectexample.wsgi:application --master --processes 4 --threads 2 --static-map /static=/code/static\\n      '\"), \"\\n    \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token key atrule\"\n  }, \"interfaces\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \":\"), \"\\n      \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token key atrule\"\n  }, \"main\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \":\"), \" \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token number\"\n  }, \"8000\"), \"\\n    \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token key atrule\"\n  }, \"environment\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \":\"), \"\\n      \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token key atrule\"\n  }, \"DEBUG\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \":\"), \" \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token string\"\n  }, \"'False'\"), \"\\n      \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token key atrule\"\n  }, \"ALLOWED_HOST\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \":\"), \" .$\", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \"{\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \"{\"), \" ingresses.web.host \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \"}\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \"}\"), \"\\n      \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token key atrule\"\n  }, \"SECRET_KEY\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \":\"), \" $\", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \"{\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \"{\"), \" parameters.django_secret_key \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \"}\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \"}\"), \"\\n      \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token key atrule\"\n  }, \"POSTGRES_DB\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \":\"), \" $\", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \"{\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \"{\"), \" services.db.environment.POSTGRES_DB \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \"}\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \"}\"), \"\\n      \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token key atrule\"\n  }, \"POSTGRES_USER\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \":\"), \" $\", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \"{\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \"{\"), \" services.db.environment.POSTGRES_USER \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \"}\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \"}\"), \"\\n      \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token key atrule\"\n  }, \"POSTGRES_PASSWORD\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \":\"), \" $\", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \"{\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \"{\"), \" services.db.environment.POSTGRES_PASSWORD \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \"}\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \"}\"), \"\\n      \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token key atrule\"\n  }, \"POSTGRES_HOST\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \":\"), \" $\", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \"{\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \"{\"), \" services.db.interfaces.main.host \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \"}\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \"}\"), \"\\n      \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token key atrule\"\n  }, \"POSTGRES_PORT\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \":\"), \" $\", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \"{\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \"{\"), \" services.db.interfaces.main.port \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \"}\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \"}\"), \"\\n    \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token key atrule\"\n  }, \"debug\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \":\"), \"\\n      \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token key atrule\"\n  }, \"command\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \":\"), \" \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \"|\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token scalar string\"\n  }, \"\\n        sh -c '\\n          python manage.py migrate --noinput\\n          python manage.py runserver 0.0.0.0:${{ services.web.interfaces.main.port }}\\n        '\"), \"\\n      \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token key atrule\"\n  }, \"environment\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \":\"), \"\\n        \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token key atrule\"\n  }, \"ALLOWED_HOST\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \":\"), \" \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token string\"\n  }, \"'*'\"), \"\\n        \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token key atrule\"\n  }, \"DEBUG\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \":\"), \" \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token string\"\n  }, \"'True'\"), \"\\n      \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token key atrule\"\n  }, \"volumes\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \":\"), \"\\n        \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token key atrule\"\n  }, \"code\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \":\"), \"\\n          \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token key atrule\"\n  }, \"mount_path\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \":\"), \" /code\\n          \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token key atrule\"\n  }, \"host_path\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \":\"), \" .\\n\\n\", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token key atrule\"\n  }, \"interfaces\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \":\"), \"\\n  \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token key atrule\"\n  }, \"web\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \":\"), \" $\", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \"{\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \"{\"), \" services.web.interfaces.main.url \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \"}\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \"}\")))), mdx(\"p\", null, \"This manifest file does the following three things:\"), mdx(\"ul\", null, mdx(\"li\", {\n    parentName: \"ul\"\n  }, \"Outlines parameter values which allow you to configure the services per deployment\"), mdx(\"li\", {\n    parentName: \"ul\"\n  }, \"Defines the services to be deployed. In this case \", mdx(\"inlineCode\", {\n    parentName: \"li\"\n  }, \"db\"), \" is the postgres database and \", mdx(\"inlineCode\", {\n    parentName: \"li\"\n  }, \"web\"), \" is the\\ndjango application. Each service block defines the interfaces (ports) that are exposed. Along with\\nthe environment variables required for the service to run.\"), mdx(\"li\", {\n    parentName: \"ul\"\n  }, \"Defines development specific configuration in service \", mdx(\"inlineCode\", {\n    parentName: \"li\"\n  }, \"debug\"), \" blocks. This is powerful because it\\nlets us define different start commands for development and production.\")), mdx(\"p\", null, \"You can check out the\\n\", mdx(\"a\", {\n    parentName: \"p\",\n    \"href\": \"https://www.architect.io/docs/components/architect-yml\"\n  }, mdx(\"inlineCode\", {\n    parentName: \"a\"\n  }, \"architect.yml\"), \" reference\"), \" for more\\ninformation on how this file works.\"), mdx(\"h2\", {\n    \"id\": \"create-your-django-project\",\n    \"style\": {\n      \"position\": \"relative\"\n    }\n  }, \"Create your Django project\", mdx(\"a\", {\n    parentName: \"h2\",\n    \"href\": \"#create-your-django-project\",\n    \"aria-label\": \"create your django project permalink\",\n    \"className\": \"anchor after\"\n  }, mdx(\"svg\", {\n    parentName: \"a\",\n    \"aria-hidden\": \"true\",\n    \"focusable\": \"false\",\n    \"height\": \"16\",\n    \"version\": \"1.1\",\n    \"viewBox\": \"0 0 16 16\",\n    \"width\": \"16\"\n  }, mdx(\"path\", {\n    parentName: \"svg\",\n    \"fillRule\": \"evenodd\",\n    \"d\": \"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"\n  })))), mdx(\"p\", null, \"Next, you\\u2019ll create a Django starter project by building the image from the build context defined in\\nthe previous procedure.\"), mdx(\"p\", null, \"Switch to the root of your project directory. Create the Django project by running the command as\\nfollows.\"), mdx(\"div\", {\n    \"className\": \"gatsby-highlight\",\n    \"data-language\": \"text\"\n  }, mdx(\"pre\", {\n    parentName: \"div\",\n    \"className\": \"language-text\"\n  }, mdx(\"code\", {\n    parentName: \"pre\",\n    \"className\": \"language-text\"\n  }, \"```console\\ndocker run --rm -it -v ${PWD}:/code $(docker build -q .) django-admin startproject architectexample .\\n```\"))), mdx(\"p\", null, \"After the command completes, list the contents of your project.\"), mdx(\"div\", {\n    \"className\": \"gatsby-highlight\",\n    \"data-language\": \"console\"\n  }, mdx(\"pre\", {\n    parentName: \"div\",\n    \"className\": \"language-console\"\n  }, mdx(\"code\", {\n    parentName: \"pre\",\n    \"className\": \"language-console\"\n  }, \"$ ls -l\\n\\ndrwxr-xr-x 2 root   root   architectexample\\n-rw-rw-r-- 1 user   user   architect.yml\\n-rw-rw-r-- 1 user   user   Dockerfile\\n-rwxr-xr-x 1 root   root   manage.py\\n-rw-rw-r-- 1 user   user   requirements.txt\"))), mdx(\"h2\", {\n    \"id\": \"configure-django\",\n    \"style\": {\n      \"position\": \"relative\"\n    }\n  }, \"Configure Django\", mdx(\"a\", {\n    parentName: \"h2\",\n    \"href\": \"#configure-django\",\n    \"aria-label\": \"configure django permalink\",\n    \"className\": \"anchor after\"\n  }, mdx(\"svg\", {\n    parentName: \"a\",\n    \"aria-hidden\": \"true\",\n    \"focusable\": \"false\",\n    \"height\": \"16\",\n    \"version\": \"1.1\",\n    \"viewBox\": \"0 0 16 16\",\n    \"width\": \"16\"\n  }, mdx(\"path\", {\n    parentName: \"svg\",\n    \"fillRule\": \"evenodd\",\n    \"d\": \"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"\n  })))), mdx(\"p\", null, \"Now it\\u2019s time to set up the database connection for Django along with a few other settings.\"), mdx(\"p\", null, \"In your project directory, edit the \", mdx(\"inlineCode\", {\n    parentName: \"p\"\n  }, \"architectexample/settings.py\"), \" file. Replace or add the the\\nfollowing:\"), mdx(\"div\", {\n    \"className\": \"gatsby-highlight\",\n    \"data-language\": \"python\"\n  }, mdx(\"pre\", {\n    parentName: \"div\",\n    \"className\": \"language-python\"\n  }, mdx(\"code\", {\n    parentName: \"pre\",\n    \"className\": \"language-python\"\n  }, mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token comment\"\n  }, \"# settings.py\"), \"\\n\", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token keyword\"\n  }, \"import\"), \" os\\n\\nSTATIC_ROOT \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token operator\"\n  }, \"=\"), \"  os\", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \".\"), \"path\", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \".\"), \"join\", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \"(\"), \"BASE_DIR\", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \",\"), \" \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token string\"\n  }, \"'static/'\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \")\"), \"\\n\\nSECRET_KEY \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token operator\"\n  }, \"=\"), \" os\", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \".\"), \"environ\", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \".\"), \"get\", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \"(\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token string\"\n  }, \"'SECRET_KEY'\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \",\"), \" \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token string\"\n  }, \"'warning-override-for-production'\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \")\"), \"\\n\\nDEBUG \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token operator\"\n  }, \"=\"), \" os\", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \".\"), \"environ\", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \".\"), \"get\", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \"(\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token string\"\n  }, \"'DEBUG'\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \",\"), \" \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token string\"\n  }, \"'False'\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \")\"), \" \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token operator\"\n  }, \"==\"), \" \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token string\"\n  }, \"'True'\"), \"\\n\\nALLOWED_HOSTS \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token operator\"\n  }, \"=\"), \" \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \"[\"), \"os\", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \".\"), \"environ\", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \".\"), \"get\", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \"(\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token string\"\n  }, \"'ALLOWED_HOST'\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \",\"), \" \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token string\"\n  }, \"''\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \")\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \"]\"), \"\\n\\nDATABASES \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token operator\"\n  }, \"=\"), \" \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \"{\"), \"\\n  \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token string\"\n  }, \"'default'\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \":\"), \" \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \"{\"), \"\\n      \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token string\"\n  }, \"'ENGINE'\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \":\"), \" \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token string\"\n  }, \"'django.db.backends.postgresql'\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \",\"), \"\\n      \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token string\"\n  }, \"'NAME'\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \":\"), \" os\", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \".\"), \"environ\", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \".\"), \"get\", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \"(\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token string\"\n  }, \"'POSTGRES_DB'\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \",\"), \" \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token string\"\n  }, \"'postgres'\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \")\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \",\"), \"\\n      \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token string\"\n  }, \"'USER'\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \":\"), \" os\", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \".\"), \"environ\", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \".\"), \"get\", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \"(\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token string\"\n  }, \"'POSTGRES_USER'\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \",\"), \" \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token string\"\n  }, \"'postgres'\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \")\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \",\"), \"\\n      \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token string\"\n  }, \"'PASSWORD'\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \":\"), \" os\", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \".\"), \"environ\", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \".\"), \"get\", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \"(\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token string\"\n  }, \"'POSTGRES_PASSWORD'\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \",\"), \" \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token string\"\n  }, \"'postgres'\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \")\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \",\"), \"\\n      \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token string\"\n  }, \"'HOST'\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \":\"), \" os\", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \".\"), \"environ\", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \".\"), \"get\", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \"(\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token string\"\n  }, \"'POSTGRES_HOST'\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \",\"), \" \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token string\"\n  }, \"'0.0.0.0'\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \")\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \",\"), \"\\n      \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token string\"\n  }, \"'PORT'\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \":\"), \" os\", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \".\"), \"environ\", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \".\"), \"get\", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \"(\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token string\"\n  }, \"'POSTGRES_PORT'\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \",\"), \" \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token string\"\n  }, \"'5432'\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \")\"), mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \",\"), \"\\n  \", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \"}\"), \"\\n\", mdx(\"span\", {\n    parentName: \"code\",\n    \"className\": \"token punctuation\"\n  }, \"}\")))), mdx(\"h2\", {\n    \"id\": \"deploy-your-django-app-locally\",\n    \"style\": {\n      \"position\": \"relative\"\n    }\n  }, \"Deploy your Django app locally\", mdx(\"a\", {\n    parentName: \"h2\",\n    \"href\": \"#deploy-your-django-app-locally\",\n    \"aria-label\": \"deploy your django app locally permalink\",\n    \"className\": \"anchor after\"\n  }, mdx(\"svg\", {\n    parentName: \"a\",\n    \"aria-hidden\": \"true\",\n    \"focusable\": \"false\",\n    \"height\": \"16\",\n    \"version\": \"1.1\",\n    \"viewBox\": \"0 0 16 16\",\n    \"width\": \"16\"\n  }, mdx(\"path\", {\n    parentName: \"svg\",\n    \"fillRule\": \"evenodd\",\n    \"d\": \"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"\n  })))), mdx(\"p\", null, \"Run the \", mdx(\"a\", {\n    parentName: \"p\",\n    \"href\": \"/docs/reference/cli#architect-deploy-environment_config_or_component\"\n  }, \"architect deploy\"), \"\\ncommand from the top level directory for your project.\"), mdx(\"div\", {\n    \"className\": \"gatsby-highlight\",\n    \"data-language\": \"console\"\n  }, mdx(\"pre\", {\n    parentName: \"div\",\n    \"className\": \"language-console\"\n  }, mdx(\"code\", {\n    parentName: \"pre\",\n    \"className\": \"language-console\"\n  }, \"$ architect dev architect.yml -i django:web\\nhttp://django.localhost:80/ => examples--django--web--latest--cvkrs58l\\n\\nhttp://localhost:50000/ => examples--django--db--latest--cbyiekkg\\nhttp://localhost:50001/ => examples--django--web--latest--cvkrs58l\\nhttp://localhost:80/ => gateway\\n\\n. . .\\n\\nweb_1  | July 30, 2020 - 18:35:38\\nweb_1  | Django version 3.0.8, using settings 'architectexample.settings'\\nweb_1  | Starting development server at http://0.0.0.0:8000/\\nweb_1  | Quit the server with CONTROL-C.\"))), mdx(\"p\", null, \"Go to \", mdx(\"inlineCode\", {\n    parentName: \"p\"\n  }, \"http://django.localhost\"), \" on a web browser to see the Django welcome page.\"), mdx(\"p\", null, mdx(\"span\", {\n    parentName: \"p\",\n    \"className\": \"gatsby-resp-image-wrapper\",\n    \"style\": {\n      \"position\": \"relative\",\n      \"display\": \"block\",\n      \"marginLeft\": \"auto\",\n      \"marginRight\": \"auto\",\n      \"maxWidth\": \"975px\"\n    }\n  }, \"\\n      \", mdx(\"a\", {\n    parentName: \"span\",\n    \"className\": \"gatsby-resp-image-link\",\n    \"href\": \"/static/1e155389e725b01d9cc2df82ea9d4e07/e548f/django-it-worked.png\",\n    \"style\": {\n      \"display\": \"block\"\n    },\n    \"target\": \"_blank\",\n    \"rel\": \"noopener\"\n  }, \"\\n    \", mdx(\"span\", {\n    parentName: \"a\",\n    \"className\": \"gatsby-resp-image-background-image\",\n    \"style\": {\n      \"paddingBottom\": \"27.599999999999998%\",\n      \"position\": \"relative\",\n      \"bottom\": \"0\",\n      \"left\": \"0\",\n      \"backgroundImage\": \"url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAGCAIAAABM9SnKAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAl0lEQVQY042OSw6DMAxEuf+Ruuw1uuiiVSE4ASex7KQEuxKLbqCfWYw00jzpdXYU3TowxSrvuU93QKqu2//UX85wNbNV9V/YzEpditR7AJewyLPU5TcsIiklyhTC7MPMJBGT9xPOMaeMiLXWj3BrjZm9dwD9OPYAA8Bwg8fdD847Zm6tfdNWVRbKGZlzmBxiIM6JIgvttV9PUV9SqAWOXgAAAABJRU5ErkJggg==')\",\n      \"backgroundSize\": \"cover\",\n      \"display\": \"block\"\n    }\n  }), \"\\n  \", mdx(\"img\", {\n    parentName: \"a\",\n    \"className\": \"gatsby-resp-image-image\",\n    \"alt\": \"Django example\",\n    \"title\": \"Django example\",\n    \"src\": \"/static/1e155389e725b01d9cc2df82ea9d4e07/e548f/django-it-worked.png\",\n    \"srcSet\": [\"/static/1e155389e725b01d9cc2df82ea9d4e07/63868/django-it-worked.png 250w\", \"/static/1e155389e725b01d9cc2df82ea9d4e07/0b533/django-it-worked.png 500w\", \"/static/1e155389e725b01d9cc2df82ea9d4e07/e548f/django-it-worked.png 975w\"],\n    \"sizes\": \"(max-width: 975px) 100vw, 975px\",\n    \"style\": {\n      \"width\": \"100%\",\n      \"height\": \"100%\",\n      \"margin\": \"0\",\n      \"verticalAlign\": \"middle\",\n      \"position\": \"absolute\",\n      \"top\": \"0\",\n      \"left\": \"0\"\n    },\n    \"loading\": \"lazy\",\n    \"decoding\": \"async\"\n  }), \"\\n  \"), \"\\n    \")), mdx(\"p\", null, \"If you want to shut down the services, simply stop the application by typing \", mdx(\"inlineCode\", {\n    parentName: \"p\"\n  }, \"Ctrl-C\"), \" in the same\\nshell where you started it.\"), mdx(\"h2\", {\n    \"id\": \"deploy-your-django-app-remotely\",\n    \"style\": {\n      \"position\": \"relative\"\n    }\n  }, \"Deploy your Django app remotely\", mdx(\"a\", {\n    parentName: \"h2\",\n    \"href\": \"#deploy-your-django-app-remotely\",\n    \"aria-label\": \"deploy your django app remotely permalink\",\n    \"className\": \"anchor after\"\n  }, mdx(\"svg\", {\n    parentName: \"a\",\n    \"aria-hidden\": \"true\",\n    \"focusable\": \"false\",\n    \"height\": \"16\",\n    \"version\": \"1.1\",\n    \"viewBox\": \"0 0 16 16\",\n    \"width\": \"16\"\n  }, mdx(\"path\", {\n    parentName: \"svg\",\n    \"fillRule\": \"evenodd\",\n    \"d\": \"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"\n  })))), mdx(\"p\", null, \"You now know how to run our stack of services locally in a repeatable way, but what about deploying\\nto production-grade environments? How do you deploy all our services to AWS ECS or Kubernetes? How\\ndo we deal with the networking and configuration of our services? Fortunately, Architect has this\\nhandled too! Since we already described our services as Architect Components, they are primed and\\nready to be deployed to production-grade container platforms without any additional work.\"), mdx(\"p\", null, \"Before you can deploy components to remote environments, you must\\n\", mdx(\"a\", {\n    parentName: \"p\",\n    \"href\": \"https://cloud.architect.io/signup\"\n  }, \"create an account with Architect\"), \".\"), mdx(\"p\", null, \"Once you've successfully created your account, go ahead and click the button below to deploy it to a\\nsample Kubernetes cluster powered by Architect Cloud:\"), mdx(\"p\", null, mdx(\"a\", {\n    parentName: \"p\",\n    \"href\": \"https://cloud.architect.io/examples/components/django/deploy?tag=latest&interface=django%3Aweb\"\n  }, mdx(\"img\", {\n    parentName: \"a\",\n    \"src\": \"https://www.architect.io/deploy-button.svg\",\n    \"alt\": \"Deploy Button\"\n  }))), mdx(\"p\", null, mdx(\"em\", {\n    parentName: \"p\"\n  }, \"Note: Deploying to production disables DEBUG, and the base URL will 404. Confirm it\\u2019s working by\\nloading \", mdx(\"inlineCode\", {\n    parentName: \"em\"\n  }, \"/admin\"), \". An empty app is no fun so take a look at the next steps.\")), mdx(\"h2\", {\n    \"id\": \"next-steps-with-django-and-docker\",\n    \"style\": {\n      \"position\": \"relative\"\n    }\n  }, \"Next steps with Django and Docker\", mdx(\"a\", {\n    parentName: \"h2\",\n    \"href\": \"#next-steps-with-django-and-docker\",\n    \"aria-label\": \"next steps with django and docker permalink\",\n    \"className\": \"anchor after\"\n  }, mdx(\"svg\", {\n    parentName: \"a\",\n    \"aria-hidden\": \"true\",\n    \"focusable\": \"false\",\n    \"height\": \"16\",\n    \"version\": \"1.1\",\n    \"viewBox\": \"0 0 16 16\",\n    \"width\": \"16\"\n  }, mdx(\"path\", {\n    parentName: \"svg\",\n    \"fillRule\": \"evenodd\",\n    \"d\": \"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"\n  })))), mdx(\"p\", null, \"Now you\\u2019re ready to build your application with the confidence that if you can run it locally, it\\nwill also run in the cloud. Django has an excellent\\n\", mdx(\"a\", {\n    parentName: \"p\",\n    \"href\": \"https://docs.djangoproject.com/en/3.1/intro/tutorial01/#creating-the-polls-app\"\n  }, \"polls tutorial\"), \",\\nwhich you should try if this is your first time. The only difference is the command to create the\\nexample polls app.\"), mdx(\"div\", {\n    \"className\": \"gatsby-highlight\",\n    \"data-language\": \"console\"\n  }, mdx(\"pre\", {\n    parentName: \"div\",\n    \"className\": \"language-console\"\n  }, mdx(\"code\", {\n    parentName: \"pre\",\n    \"className\": \"language-console\"\n  }, \"docker run --rm -it -v ${PWD}:/code $(docker build -q .) python manage.py startapp polls\"))), mdx(\"h2\", {\n    \"id\": \"learn-more-about-how-to-deploy-faster-and-more-securely\",\n    \"style\": {\n      \"position\": \"relative\"\n    }\n  }, \"Learn more about how to deploy faster and more securely\", mdx(\"a\", {\n    parentName: \"h2\",\n    \"href\": \"#learn-more-about-how-to-deploy-faster-and-more-securely\",\n    \"aria-label\": \"learn more about how to deploy faster and more securely permalink\",\n    \"className\": \"anchor after\"\n  }, mdx(\"svg\", {\n    parentName: \"a\",\n    \"aria-hidden\": \"true\",\n    \"focusable\": \"false\",\n    \"height\": \"16\",\n    \"version\": \"1.1\",\n    \"viewBox\": \"0 0 16 16\",\n    \"width\": \"16\"\n  }, mdx(\"path\", {\n    parentName: \"svg\",\n    \"fillRule\": \"evenodd\",\n    \"d\": \"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"\n  })))), mdx(\"p\", null, \"Congratulations! That's all it takes to take a locally runnable component and deploy it to a remote\\ncluster with Architect.\"), mdx(\"p\", null, mdx(\"em\", {\n    parentName: \"p\"\n  }, \"Note: You can register your own Kubernetes or ECS cluster on the platforms tab of your account.\\nThen create an environment for that platform and try deploying again!\")), mdx(\"p\", null, mdx(\"em\", {\n    parentName: \"p\"\n  }, \"Note: We skipped the component registration step in this tutorial because we've already published\\nthis example component to the registry. If you want to try publishing yourself, simply change the\\ncomponent name to include your account name as the prefix instead of \", mdx(\"inlineCode\", {\n    parentName: \"em\"\n  }, \"examples\"), \" and then run\\n\", mdx(\"inlineCode\", {\n    parentName: \"em\"\n  }, \"architect register architect.yml\"), \" in the project directory.\\n\", mdx(\"a\", {\n    parentName: \"em\",\n    \"href\": \"/docs/getting-started/introduction#register-a-component\"\n  }, \"Docs\"))), mdx(\"p\", null, mdx(\"a\", {\n    parentName: \"p\",\n    \"href\": \"https://cloud.architect.io/examples/components/django/\"\n  }, \"View component\")), mdx(\"p\", null, \"If you\\u2019d like to read more about how Architect enables safe, fast deployments, we\\u2019ve got you\\ncovered:\"), mdx(\"ul\", null, mdx(\"li\", {\n    parentName: \"ul\"\n  }, mdx(\"a\", {\n    parentName: \"li\",\n    \"href\": \"https://www.architect.io/blog/why-distributed-apps-need-dependency-management\"\n  }, \"Why Distributed Apps Need Dependency Management\")), mdx(\"li\", {\n    parentName: \"ul\"\n  }, mdx(\"a\", {\n    parentName: \"li\",\n    \"href\": \"https://www.architect.io/blog/creating-microservices-nestjs\"\n  }, \"Creating Microservices: Nest.js\")), mdx(\"li\", {\n    parentName: \"ul\"\n  }, \"Cycling Credentials Without Cycling\\nContainers](\", mdx(\"a\", {\n    parentName: \"li\",\n    \"href\": \"https://www.architect.io/blog/cycling-credentials-without-cycling-containers\"\n  }, \"https://www.architect.io/blog/cycling-credentials-without-cycling-containers\"), \")\")), mdx(\"p\", null, \"And as always, we\\u2019d love to have you follow along as we release new content and features. Check us\\nout on Twitter \", mdx(\"a\", {\n    parentName: \"p\",\n    \"href\": \"https://twitter.com/architect_team\"\n  }, \"@architect_team\"), \"!\"));\n}\n;\nMDXContent.isMDXComponent = true;","excerpt":"Django is an excellent Python Web framework, but it can be tricky to deploy to the cloud. If you’re\nbuilding in Python, you want the confidence that what you develop and deploy locally will translate…","tableOfContents":{"items":[{"url":"#prerequisites","title":"Prerequisites"},{"url":"#django-docker-and-more","title":"Django, Docker, and more"},{"url":"#create-your-django-project","title":"Create your Django project"},{"url":"#configure-django","title":"Configure Django"},{"url":"#deploy-your-django-app-locally","title":"Deploy your Django app locally"},{"url":"#deploy-your-django-app-remotely","title":"Deploy your Django app remotely"},{"url":"#next-steps-with-django-and-docker","title":"Next steps with Django and Docker"},{"url":"#learn-more-about-how-to-deploy-faster-and-more-securely","title":"Learn more about how to deploy faster and more securely"}]},"frontmatter":{"title":"Deploy your Django app with Docker","description":"Follow our guide to deploy a Django app safely and securely on your local machine via Docker, so you can launch to the cloud with confidence.","author":"TJ Higgins","date":"2021-01-14","image":{"childImageSharp":{"gatsbyImageData":{"layout":"constrained","images":{"fallback":{"src":"/static/e647feeee382c3c69da75750ff0ada79/7a23e/deploy-django-app-docker.png","srcSet":"/static/e647feeee382c3c69da75750ff0ada79/4ca58/deploy-django-app-docker.png 250w,\n/static/e647feeee382c3c69da75750ff0ada79/0251a/deploy-django-app-docker.png 500w,\n/static/e647feeee382c3c69da75750ff0ada79/7a23e/deploy-django-app-docker.png 1000w,\n/static/e647feeee382c3c69da75750ff0ada79/fca1d/deploy-django-app-docker.png 2000w","sizes":"(min-width: 1000px) 1000px, 100vw"},"sources":[{"srcSet":"/static/e647feeee382c3c69da75750ff0ada79/002ed/deploy-django-app-docker.webp 250w,\n/static/e647feeee382c3c69da75750ff0ada79/15bdf/deploy-django-app-docker.webp 500w,\n/static/e647feeee382c3c69da75750ff0ada79/27c85/deploy-django-app-docker.webp 1000w,\n/static/e647feeee382c3c69da75750ff0ada79/0dc98/deploy-django-app-docker.webp 2000w","type":"image/webp","sizes":"(min-width: 1000px) 1000px, 100vw"}]},"width":1000,"height":563}}}}},"next":null,"previous":null}]}},"pageContext":{"slug":"django-docker-tutorial"}},
    "staticQueryHashes": ["764694655"]}