Let’s look at how to bootstrap a Django Project pre-loaded with the basic requirements needed in order to quickly get a project up and running. Further, beyond the project structure, most bootstrapped projects also take care of setting up the development and production environment settings, without troubling the user much – so we’ll look at that as well.
让我们看一下如何引导一个预加载了基本要求的Django Project,以便快速启动并运行一个项目。 此外,除了项目结构之外,大多数自举项目还负责设置开发和生产环境设置,而不会给用户带来太多麻烦,因此我们也会对此进行研究。
![cookiecutter django docker](https://realpython.com/images/blog_images/cookiecutter-django-docker.png)
We’ll be using the popular cookiecutter-django as the bootstrapper for our Django Project along with Docker to manage our application environment.
我们将使用流行的cookiecutter-django作为Django项目的引导程序,并使用Docker来管理我们的应用程序环境。
Let’s begin!
让我们开始!
本地设置 (Local Setup)
Start by installing cookiecutter globally:
首先全局安装cookiecutter :
|
Now execute the following command to generate a bootstrapped django project:
现在执行以下命令来生成一个引导的django项目:
|
This command runs cookiecutter with the cookiecutter-django repo, allowing us to enter project-specific details:
此命令使用cookiecutter-django存储库运行cookiecutter,使我们能够输入特定于项目的详细信息:
|