How to do it...

Once you have your prerequisites installed, create a directory where all your Django projects will be stored—for example, projects under your home directory. Go through the following steps after creating the directory:

  1. Go to the newly created directory and create a virtual environment that uses the shared system site packages:
$ cd ~/projects
$ mkdir myproject_website
$ cd myproject_website
$ python3 -m venv env
  1. To use your newly created virtual environment, you need to execute the activation script in your current shell. This can be done with the following command:
$ source env/bin/activate
  1. Depending on the shell you are using, the source command may not be available. Another way to source a file is with the following command, which has the same result (note the space between the dot and env):
$ . env/bin/activate
  1. You will see that the prompt of the command-line tool gets a prefix of the project name, as follows:
(env)$
  1. To get out of the virtual environment, type the following command:
(env)$ deactivate
..................Content has been hidden....................

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