Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions code_editor/README.md
Original file line number Diff line number Diff line change
@@ -1,25 +1,25 @@
# Code editor

You're about to create your first file of code, so it's time to download a code editor!
You're about to write your first line of code, so it's time to download a code editor!

There is a lot of different ones and it really depends on your needs. Most Python programmers use complex, but super powerful IDEs (Integrated Development Environment), like PyCharm. But for you, as a beginner, we're recommending something simple, yet powerful.
There are a lot of different editors and it largely boils down to personal preference. Most Python programmers use complex but extremely powerful IDEs (Integrated Development Environments), such as PyCharm. As a beginner, however - that's probably less suitable; our recommendations are equally powerful, but a lot more simple.

Our suggestions are below, but feel free to ask your coach what is their preference, as it'll be easier to get help from them :)
Our suggestions are below, but feel free to ask your coach what their preference is - it'll be easier to get help from them.

## Gedit

Gedit is an open-source, free editor, available for all operating systems.

[Download it here.](https://wiki.gnome.org/Apps/Gedit#Download)
[Download it here](https://wiki.gnome.org/Apps/Gedit#Download)

## Sublime Text 2

Sublime Text is a very popular editor with a free evaluation period (you can use it for free as long as you need, but it'd be good to buy a license some day :)). It's easy to install and use, available for all operating systems.
Sublime Text is a very popular editor with a free evaluation period. It's easy to install and use, and available for all operating systems.

[Download it here.](http://www.sublimetext.com/2)
[Download it here](http://www.sublimetext.com/2)

## Atom

Atom is rather new code editor created by [Github](http://github.com/). It's free, open-sourced, easy to install and use editor, but available only for Mac OS X for now. It'll be available for other systems in the future.
Atom is an extremely new code editor created by [GitHub](http://github.com/). It's free, open-source, easy to install and easy to use, but is only available as a prebuilt program on Windows and OS X at the moment. It'll be available prebuilt for Linux in the future.

[Download it here.](https://atom.io/)
[Download it here](https://atom.io/)
40 changes: 20 additions & 20 deletions database/README.md
Original file line number Diff line number Diff line change
@@ -1,73 +1,73 @@
# Database

Most of web applications have their own database. A database is a collection of data. This is a place in which you will store all information about users, all your blog post texts, etc..
Most web applications have their own database. A database is a collection of data. This is a place in which you will store information about users, your blog posts, etc.

We will be using a PostgreSQL database to store our data. It would be easier to use a default Django database called *sqlite*, but it's not good for production use (by *production* we mean: real, running websites). If you want to have your application available in the Internet, not only on your computer, you will need PostgreSQL.
We will be using a PostgreSQL database to store our data. It would be easier to use the default Django database adapter - called *sqlite* - but it's not good for production use. *Production* means out on the big, scary internet - running real websites accessed by more than a handful of users. If you want your application to be available to the world, not just running on your computer, you'll need PostgreSQL.

# PostgreSQL installation

## Windows

PostgreSQL is recommending to install it using a program you can find here: http://www.enterprisedb.com/products-services-training/pgdownload#windows
The easiest way to install Postgres on Windows is using a program you can find here: http://www.enterprisedb.com/products-services-training/pgdownload#windows

Choose a newest version available for your operating system. Download this Installer, run it and then follow the instructions available here: http://www.postgresqltutorial.com/install-postgresql/. Take note of the installation directory, you will need it in the next step (most likely it will be `C:\Program Files\PostgreSQL\9.3`).
Choose the newest version available for your operating system. Download the installer, run it and then follow the instructions available here: http://www.postgresqltutorial.com/install-postgresql/. Take note of the installation directory as you will need it in the next step (typically, it's `C:\Program Files\PostgreSQL\9.3`).

## Mac OS X

The easiest way is to download a free [Postgres.app](http://postgresapp.com/) and install it like any other application on your operating system.
The easiest way is to download the free [Postgres.app](http://postgresapp.com/) and install it like any other application on your operating system.

Go ahead, download it, drag to the Applications folder and run by double clicking. That's it!
Download it, drag to the Applications folder and run by double clicking. That's it!

## Linux

Of course, installation depends on Linux distribution. We've added most popular ones, but if you can't find yours, [here are all the tutorials](https://wiki.postgresql.org/wiki/Detailed_installation_guides#General_Linux).
Installation steps vary from distribution to distribution. Below are the commands for Ubuntu and Fedora, but if you're using a different distro [take a look at the PostgreSQL documentation](https://wiki.postgresql.org/wiki/Detailed_installation_guides#General_Linux).

### Ubuntu

Go to your console and run a following command:
Run the following command:

sudo apt-get install postgresql postgresql-contrib

### Fedora

Run the following command:

sudo yum install postgresql93-server

# Create database

Now we need to create our database user and our first database. You can add many databases in PostgreSQL, so if you have more than one website, you should have a separate database for each one!
Next up, we need to create our first database, and a user that can access that database. PostgreSQL lets you create as many databases and users as you like, so if you're running more than one site you should create a database for each one.

## Windows

If you're using Windows, there is a little bit more we need to do. For now you don't need to understand these steps, but feel free to ask your coach if you're curious!
If you're using Windows, there's a couple more steps we need to complete. For now it's not important for you to understand the configuration we're doing here, but feel free to ask your coach if you're curious as to what's going on.

1. Open the Command Prompt (Start menu → All Programs → Accessories → Command Prompt)
2. Type the following `setx PATH "%PATH%;C:\Program Files\PostgreSQL\9.3\bin"` (you can also paste things into the Command Prompt by right clicking and selecting `Paste`). Make sure that the path is the same as you noted during installation with `\bin` added at the end. You should see the message `SUCCESS: Specified value was saved.`.
3. Close the Command Prompt and it open again.
2. Run the following by typing it in and hitting return: `setx PATH "%PATH%;C:\Program Files\PostgreSQL\9.3\bin"`. You can paste things into the Command Prompt by right clicking and selecting `Paste`. Make sure that the path is the same one you noted during installation with `\bin` added at the end. You should see the message `SUCCESS: Specified value was saved.`.
3. Close and then reopen the Command Prompt.

## Create the database

First, let's make our console into postgres mode by typing `psql`. Remember the part about console?
>On Mac OS X you can do this by launching the `Terminal` application (it's in Applications → Utilities). On Linux, it's probably under Applications → Accessories → Terminal. On Windows you need to go to Start menu → All Programs → Accessories → Command Prompt. Further, on Windows, `psql` might require logging in using the username and password you chose during installation. If `psql` is asking you for password and doesn't seem to work, try `psql -U <username> -W` first and enter the password later.
First, let's launch the Postgres console by running `psql`. Remember how to launch the console?
>On Mac OS X you can do this by launching the `Terminal` application (it's in Applications → Utilities). On Linux, it's probably under Applications → Accessories → Terminal. On Windows you need to go to Start menu → All Programs → Accessories → Command Prompt. Furthermore, on Windows, `psql` might require logging in using the username and password you chose during installation. If `psql` is asking you for a password and doesn't seem to work, try `psql -U <username> -W` first and enter the password later.

$ psql
psql (9.3.4)
Type "help" for help.
#

Our `$` now changed into `#`, it means that we're now giving commands to PostgreSQL. Let's create a user:
Our `$` now changed into `#`, which means that we're now sending commands to PostgreSQL. Let's create a user:

# CREATE USER name;
CREATE ROLE

Of course, replace `name` with your own name. Remember that you should not use diacritic letters and whitespaces, i.e. `bożena maria` is invalid! You need to transform it into `bozena_maria`.
Replace `name` with your own name. You shouldn't use accented letters or whitespace (e.g. `bożena maria` is invalid - you need to convert it into `bozena_maria`).

Now it's time to create a database for your Django project:

# CREATE DATABASE djangogirls OWNER name;
CREATE DATABASE

Remember to replace `name` with the name you've chosen (i.e. `bozena_maria`).

Awesome! All ready!

Remember to replace `name` with the name you've chosen (e.g. `bozena_maria`).

Great - that's databases all sorted!
65 changes: 43 additions & 22 deletions django_installation/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,37 +4,37 @@

## Virtual environment

Before we will install Django, we will make you install something very, very handy and useful, that will help you keeping everything tidy on your computer. It is possible to skip this step, but we think, that you should start with the best setup possible to save a lot of troubles in the future!
Before we install Django, we'll get you to install an extremely useful tool that will help keep your coding environment tidy on your computer. It's possible to skip this step, but it's highly recommended not to - starting with the best possible setup will save you a lot of trouble in the future!

That's why, we want you to create a Virtual environment (also called `virtualenv`). It will isolate things you do from your computer, so you will have everything important in one place. Neat, right?
So, let's create a **virtual environment** (also called a *virtualenv*). It will isolate your Python/Django setup on a per-project basis, meaning that any changes you make to one website won't affect any others you're also developing. Neat, right?

All you need to do is finding a folder in which you want to create the `virtualenv`, for example your home directory. In Windows it could look like: `C:\Users\Name\` (where `Name` is a name of the user).
All you need to do is find a folder 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).

### Windows

To create a new `virtualenv` you need to open the console (we already told you how to open it, remember?) and type there `C:\Python\python -m venv blog`. It will look like this:
To create a new `virtualenv`, you need to open the console (we told you about that a few tutorials ago - remember?) and run `C:\Python\python -m venv blog`. It will look like this:

C:\Users\Name> C:\Python34\python -m venv blog

where `C:\Python34\python` is folder in which you previously installed Python and `blog` is a name of your `virtualenv`. You can use any other name, but stick to lowercase and use no spaces. It is also good idea to keep the name short :).
where `C:\Python34\python` is the folder in which you previously installed Python and `blog` is a name of your `virtualenv`. You can use any other name, but stick to lowercase and use no spaces. It is also good idea to keep the name short - you'll be referencing it a lot!

### Linux and OS X

Creating `virtualenv` in both Linux and OS X is as simple as typing in console (remember, that we expect that you have python 3.4 installed):
Creating a `virtualenv` on both Linux and OS X is as simple as running:

~$ python3 -m venv blog

### Working with virtualenv
## Working with virtualenv

The command above will create a folder `blog` that contains our virtual environment (basically bunch of folders and files). All we want to do now is starting it by:
The command above will create a folder called `blog` that contains our virtual environment (basically bunch of folders and files). All we want to do now is starting it by running:

C:\Users\Name> blog\Scripts\activate

for Windows users, or:
on Windows, or:

~$ source blog/bin/activate

for OS X and Linux.
on OS X and Linux.

You will know that you have `virtualenv` started when you see that the prompt in your console looks like:

Expand All @@ -44,36 +44,57 @@ or:

(blog) ~$

so the prefix `(blog)` appears!
Notice the prefix `(blog)` appears!

When working within a virtual environment, `python` will automatically refer to the correct version so you can use `python` instead of `python3`.

Ok, we have all important things in place. We can finally install Django!
OK, we have all important dependencies in place. We can finally install Django!

## Installing Django

Now, when you have your `virtualenv` started, you can install Django using PIP. In console you type `pip install django==1.6.5`.
Now that you have your `virtualenv` started, you can install Django using `pip`. In the console, run `pip install django==1.6.5`.

(blog) ~$ pip install django==1.6.5
Downloading/unpacking django==1.6.5
Installing collected packages: django
Successfully installed django
Cleaning up...

### Installing PostgreSQL package for Python
## Installing PostgreSQL package for Python

Next up, we need to install a package which lets Python talk to PostgreSQL - this is called `psycopg2`. The installation instructions differ slightly between Windows and Linux/OS X.

### Windows

The installation steps vary slightly depending on whether your computer runs 32 or 64 bit Windows. If you're not sure which you're running, ask your coach.

#### 32-bit

Run the following in your console:

(blog) C:\Users\Name> pip install git+https://github.com/nwcell/psycopg2-windows.git@win32-py34#egg=psycopg2

#### 64-bit

Run the following in your console:

(blog) C:\Users\Name> pip install git+https://github.com/nwcell/psycopg2-windows.git@win64-py34#egg=psycopg2

### Linux and OS X

Run the following in your console:

(blog) ~$ pip install psycopg2

---

If that goes well, you'll see something like this

Downloading/unpacking psycopg2
Installing collected packages: psycopg2
Successfully installed psycopg2
Cleaning up...

On Windows, you will probably have to replace the first line with
`pip install git+https://github.com/nwcell/psycopg2-windows.git@win32-py34#egg=psycopg2`
or
`pip install git+https://github.com/nwcell/psycopg2-windows.git@win64-py34#egg=psycopg2`
depending on whether you have 32 or 64 bit Windows.

Once it's completed execute `python -c "import psycopg2"`. If you get no errors, everything works.
Once that's completed, run `python -c "import psycopg2"`. If you get no errors, everything's installed successfully.

That's it! Now you are finally ready to create a Django application! But to do that, you need some nice program to edit the code...
That's it! You're now (finally) ready to create a Django application! But to do that, you need a nice program to write your code in...
Loading