Choosing a project type

As we select the option to create a new project, we will be taken to a configuration window. This window is used to specify which general project you are working on, where you'd like to store the project, and which interpreter/environment to use. The prompt in which you can select your project type is as follows:

Choosing a PyCharm project type

If you are using the Community edition, you will not see the left-hand side of the window. Don't panic, as that section is only used to create boilerplate files for specific types of Python projects, which can also be generated manually without any difficulty in the Community edition anyway.

This section will not be irrelevant to users of the Community edition either, as we will also be discussing the options of specifying the location and the interpreter for your projects, which are available in both editions, so be sure to stick around and not skip to the next section!

With that said, let's consider the left-hand side of the window for now. From this section, we can see all the available options for the type of a PyCharm project—pure, minimal Python, Django or Flask for web development, Google App Engine, and so on. If you do not select the first option, Pure Python, then various base files with boilerplate code are generated in a way that corresponds to the type of project that you select.

To see this generation of boilerplate code in action, go ahead and choose, for example, Django as the project type in the left-hand panel (if you are using the Professional edition). In the Location prompt (which is at the top of the main panel), simply choose a convenient location for this project in your system. The more important option is the specification of the project interpreter, which can be achieved in the section directly below the Location prompt.

The default option for the project interpreter is to create a new virtual environment altogether, which is also a general good practice in Python development. If you click on the section to expand it, you will see the following:

Selecting the project's location and interpreter

Here, you can also see various options regarding the creation of the virtual environment. If you are not familiar with the concepts of the virtual environment and interpreter, we will be discussing them, along with the options to manage them in PyCharm projects, in the next section.

For now, go ahead and proceed with our new project creation. Here, I am creating a new Django project called TestDjango (note that you can specify the location of the project as you type in the project name). This project is to have a new environment created using Virtualenv in the project folder itself. Again, if you are using the Community edition of PyCharm, ignore the option to specify the project type.

In the section directly below Project Interpreter, we will see More Settings. Expand it, and you will see that this section contains various Django-related configuration options such as the template language (Django or Jinja2), the name of the templates folder, the optional name for the application, as well as whether PyCharm should enable the Django admin option or not.

Don't change any of these settings for now; if you are interested in leveraging PyCharm's power to improve your Django projects, an entire part of our book dedicated to Django can be found later. Let's continue.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.147.104.248