|
1 |
| -You can [skip right over this section](http://tutorial.djangogirls.org/en/installation/#install-python) |
2 |
| -if you're not using RunCode Cloud Development environment. If you are, your installation experience will be a little different. |
3 |
| -You can ignore the rest of the installation instructions as you do not need to install anything locally, |
4 |
| -you just need to create three online accounts. |
| 1 | +If you are using RunCode Cloud development environment, your installation experience will be a little different. You can ignore the rest of the installation instructions as you do not need to install anything locally, you just need to create three online accounts. |
5 | 2 |
|
6 |
| -## About RunCode |
7 |
| -RunCode is a cloud development environment which people can use without the need to install Python, Django and Visual |
8 |
| -Studio Code editor locally on their machines. This cloud environment enables anyone to work from any device that has |
9 |
| -an internet connection, including cellphones, tablets, laptop or desktop. |
10 |
| - |
11 |
| -This removes the need for you to install packages on a borrowed laptop or the need for you to own a laptop to attend the workshop or follow this tutorial from home. This will also save you time required for setting up your development |
12 |
| -environment and you can always do the installation later own as a follow-up after finishing the tutorial. |
| 3 | +## Create a GitHub account |
| 4 | +Go to [GitHub.com](https://github.com/) and sign up for a new, free user account.Skip this step if you already did |
| 5 | +this in the previous step so you could sign up for RunCode. |
13 | 6 |
|
14 | 7 | ## Create a RunCode account
|
15 | 8 | Go to [RunCode.io](https://runcode.io/) and sign up for a new, free user account. You need to have a
|
16 | 9 | [Google.com](https://www.google.com/intl/en-GB/gmail/about/) account or [GitHub.com](https://github.com/)
|
17 | 10 | which you can sign up with.
|
18 | 11 |
|
19 |
| -## Create a GitHub account |
20 |
| -Go to [GitHub.com](https://github.com/) and sign up for a new, free user account.Skip this step if you already did |
21 |
| -this in the previous step so you could sign up for RunCode. |
22 |
| - |
23 | 12 | ## Create a PythonAnywhere account {#pythonanywhere-account}
|
24 |
| -{% include "/deploy/signup_pythonanywhere.md" %} |
| 13 | +{% include "/deploy/signup_pythonanywhere.md" %} |
| 14 | + |
| 15 | +## Command Line |
| 16 | +To open the Ubuntu terminal on RunCode, go to Workspaces → New Workspace → Blank. This will open a new Visual Studio Code workspace which has an Ubuntu terminal in the bottom pane. |
| 17 | + |
| 18 | +Altenatively, you can go to Workspaces → New Workspace → Jupyter Lab. This will open a Python prompt which is depicted by `>>>`, you can type `exit()` to get back to the Ubuntu terminal. |
| 19 | + |
| 20 | +Ubuntu is a version of Linux so for all command line instructions later in the tutorial you can follow Linux instructions. |
| 21 | + |
| 22 | +## Virtual Environment |
| 23 | +Before we install Django we will get you to install an extremely useful tool to help keep your coding environment tidy on your computer. It's possible to skip this step, but it's highly recommended. Starting with the best possible setup will save you a lot of trouble in the future! |
| 24 | + |
| 25 | +So, let's create a **virtual environment** (also called a *virtualenv*). Virtualenv will isolate your Python/Django setup on a per-project basis. This means that any changes you make to one website won't affect any others you're also developing. Neat, right? |
| 26 | + |
| 27 | +All you need to do is find a directory in which you want to create the `virtualenv`; your home directory, for example. On Windows, it might look like `C:\Users\Name\` (where `Name` is the name of your login). |
| 28 | + |
| 29 | +For this tutorial we will be using a new directory `djangogirls` from your home directory: |
| 30 | + |
| 31 | +{% filename %}command-line{% endfilename %} |
| 32 | +``` |
| 33 | +$ mkdir djangogirls |
| 34 | +$ cd djangogirls |
| 35 | +``` |
| 36 | + |
| 37 | +We will make a virtualenv called `myvenv`. |
| 38 | + |
| 39 | +To create a new `virtualenv` on RunCode, you first need to install the `virtualenv` module. To do so, first you need to update |
| 40 | +the packages in your environment |
| 41 | +>``` |
| 42 | +>$ sudo apt-get update -y |
| 43 | +>``` |
| 44 | +> then install `virtualenv` by running the command: |
| 45 | +>``` |
| 46 | +>$ sudo apt-get install -y virtualenv |
| 47 | +>``` |
| 48 | +
|
| 49 | +> After this you can create the `virtualenv` run the command: |
| 50 | +>``` |
| 51 | +>$ virtualenv -p python myvenv |
| 52 | +>``` |
| 53 | +> and a new `virtualenv` with the name `myvenv` or whatever name you chose should be created in your `djangogirls` folder. |
| 54 | +
|
| 55 | +## Working with a Virtual Environment |
| 56 | +>Start your virtual environment by running: |
| 57 | +>``` |
| 58 | +>$ . myvenv/bin/activate |
| 59 | +>``` |
| 60 | +
|
| 61 | +### Installing packages with requirements |
| 62 | +
|
| 63 | +A requirements file keeps a list of dependencies to be installed using |
| 64 | +`pip install`: |
| 65 | +
|
| 66 | +First create a `requirements.txt` file inside of the `djangogirls/` folder, using the code editor that you installed earlier. You do this by opening a new file in the code editor and then saving it as `requirements.txt` in the `djangogirls/` folder. Your directory will look like this: |
| 67 | +
|
| 68 | +``` |
| 69 | +djangogirls |
| 70 | +├── myvenv |
| 71 | +│ └── ... |
| 72 | +└───requirements.txt |
| 73 | +``` |
| 74 | +
|
| 75 | +In your `djangogirls/requirements.txt` file you should add the following text: |
| 76 | +
|
| 77 | +{% filename %}djangogirls/requirements.txt{% endfilename %} |
| 78 | +``` |
| 79 | +Django~={{ book.django_version }} |
| 80 | +``` |
| 81 | +
|
| 82 | +Now, run `pip install -r requirements.txt` to install Django. |
| 83 | +
|
| 84 | +{% filename %}command-line{% endfilename %} |
| 85 | +``` |
| 86 | +(myvenv) ~$ pip install -r requirements.txt |
| 87 | +Collecting Django~={{ book.django_version }} (from -r requirements.txt (line 1)) |
| 88 | + Downloading Django-{{ book.django_version }}-py3-none-any.whl (7.9MB) |
| 89 | +Installing collected packages: Django |
| 90 | +Successfully installed Django-{{ book.django_version }} |
| 91 | +``` |
| 92 | +
|
| 93 | +That's it! You're now (finally) ready to create a Django application! |
0 commit comments