Setting up the web app: Difference between revisions

From OpenHatch wiki
Content added Content deleted
imported>Jesstess
No edit summary
imported>Pcollins
(Undo revision 8701 by 109.230.216.225 (talk))
 
(21 intermediate revisions by 6 users not shown)
Line 25: Line 25:
them your name and email address and set a password that you'll use to
them your name and email address and set a password that you'll use to
log into the account.
log into the account.

Note! alwaysdata won't work with Internet Explorer 6. If you use IE6, let a staff member know.


* [http://alwaysdata.com/ Go to alwaysdata.com]
* [http://alwaysdata.com/ Go to alwaysdata.com]
Line 30: Line 32:
* Choose the "Pack gratuit (10 Mo)". It means "Free account (10 megabytes of storage)".
* Choose the "Pack gratuit (10 Mo)". It means "Free account (10 megabytes of storage)".
* Choose the '''monthly''' payment plan.
* Choose the '''monthly''' payment plan.

'''Note''': They will send you your password by email. If you feel
queasy about receiving your password by email, then use one that you
don't mind receiving.


On the back of this piece of paper, take a moment to write down the
On the back of this piece of paper, take a moment to write down the
Line 43: Line 41:
Github.com is the most popular git-based service you can use to store files.
Github.com is the most popular git-based service you can use to store files.


Go to http://github.com/ and create an account. You can choose whatever username you want. Once it is configured, you can continue on through these setup instructions.
Go to http://github.com/ and create an account. You can choose whatever username you want. For now, just create an account, and then you can continue on through these setup instructions.


=== Testing ===
=== Testing ===
Line 56: Line 54:


* [[Boston Python Workshop/Friday handout/OS X 10.6 or 10.5|OS X 10.6 or 10.5]] (Snow Leopard or Leopard). [http://www.wiki.devchix.com/index.php?title=Determining_your_OS_X_version Click here if you're not sure what version of OS X you have].
* [[Boston Python Workshop/Friday handout/OS X 10.6 or 10.5|OS X 10.6 or 10.5]] (Snow Leopard or Leopard). [http://www.wiki.devchix.com/index.php?title=Determining_your_OS_X_version Click here if you're not sure what version of OS X you have].
* [[/Windows|Windows]] (XP, Vista, or 7)
* [[Boston_Python_workshop/Friday_handout/Windows|Windows]] (XP, Vista, or 7)
* [[/Ubuntu and Debian|Ubuntu and Debian]]
* [[Boston_Python_workshop/Friday_handout/Ubuntu and Debian|Ubuntu_Debian_Fedora]]


== Section 3: ColorWall Setup==
== Section 3: Configuring your accounts on the web ==

You'll be writing effects for a ColorWall like the one in this video!
{{#ev:vimeo|16522975}}

<ol>
<li>Download the ColorWall project from http://mit.edu/jesstess/www/BostonPythonWorkshop
<ul>
<li>Windows users, try http://mit.edu/jesstess/www/BostonPythonWorkshop/ColorWall.zip first. The file should automatically get uncompressed when you download it.</li>
<li>OS X and Linux users can use either the .zip or .tar.gz file.</li>
</ul>
</li>
<li>The ColorWall project has no dependencies to install on common, modern Windows, OS X, and Linux* distributions. To confirm that you have no dependencies to install, at Python prompt run:

<pre>import Tkinter</pre>

If that command results in an <code>ImportError</code>, let a staff member know and we'll help get your dependencies set up. (*On some Debian installation, when you <code>import Tkinter</code> it will tell you that you need to install the <code>python-tk</code> package, which you should do)</li>
<li>Run the example effects</li>
</ol>

== Section 4: Configuring your accounts on the web ==


=== Alwaysdata: Enable SSH ===
=== Alwaysdata: Enable SSH ===
Line 86: Line 64:
* In the left-hand side, underneath '''Remote access''', click '''SSH'''
* In the left-hand side, underneath '''Remote access''', click '''SSH'''
* Click the gear icon for your user
* Click the gear icon for your user
* Click the "Enabled" checkbox to enable ssh access.
* Click the "Enabled" checkbox to enable ssh access. [hint: you can use a different passphrase than the SSH-key on localhost]
* Click ''Submit''!
* Click ''Submit''!


Line 93: Line 71:
Follow Github's instructions:
Follow Github's instructions:


* Go to http://help.github.com/key-setup-redirect
* Go to https://github.com/account (log in if you have to), click the "SSH Public Keys" tab, and click "Add another public key"
* Go to https://github.com/account (log in if you have to), click the "SSH Public Keys" tab, and click "Add another public key"
* Follow ''just'' that section.


To find your public key on Windows, type this from a GitBash:
To find your public key on Windows, type this from a GitBash:
Line 113: Line 89:
If it worked, you'll see a new repository listed in your Github.com account, and it will have a README file explaining what it is.
If it worked, you'll see a new repository listed in your Github.com account, and it will have a README file explaining what it is.


== Section 5: Deploying your first web application ==
== Section 4: Deploying your first web application ==


Remember how you made a Django site earlier in the directions? The volunteers made a site like, too, and we added some special configuration to make it work well with Alwaysdata.com.
Remember how you made a Django site earlier in the directions? The volunteers made a site like, too, and we added some special configuration to make it work well with Alwaysdata.com.
Line 122: Line 98:


* Go to https://github.com/paulproteus/workshop_mysite
* Go to https://github.com/paulproteus/workshop_mysite
* Click the "Fork" icon
* Click the "Fork" icon which brings you to your personal fork of the project.
* Go to your personal fork of the project.


=== Clone it to alwaysdata.com ===
=== Clone it to alwaysdata.com ===
Line 136: Line 111:
git clone
git clone


* Now '''paste''' in the repository URL, and hit '''enter'''. The full command will look something like "git clone git@github.com:paulproteus/workshop_mysite.git".
* Now '''paste''' in the repository URL, and hit '''enter'''. The full command will look something like "git clone git://github.com/paulproteus/workshop_mysite.git".


=== Configure alwaysdata.com to serve your site ===
=== Configure alwaysdata.com to serve your site ===
Line 144: Line 119:
* Go to the Alwaysdata.com '''Domains''' administration page: https://admin.alwaysdata.com/domain/
* Go to the Alwaysdata.com '''Domains''' administration page: https://admin.alwaysdata.com/domain/
* Find your domain, and click the gear to '''edit'''.
* Find your domain, and click the gear to '''edit'''.
* Enter this into the form as the '''Root directory''':
* Enter /workshop_mysite/public/ into the form as the '''Root directory''':

=== Make sure alwaysdata.com is set up properly to serve your site ===

* On the '''domain''' configuration page, grab the 'name' which is your personal alwaysdata.net web address.
* Enter that into your browser's address bar (type or copy/paste). You should see the Django welcome page message congratulating you.


===Almost Done!===
/workshop_mysite/public/
'''Go to''' [https://openhatch.org/wiki/Boston_Python_workshop/Friday_handout#Web_Developer:_You.27re_ready_for_Saturday.21 Web App Section] of Friday's installation page and finish up!

Latest revision as of 16:58, 12 October 2012

Objective

After going through this setup document, you will have a Python, git, and Django environment that lets you write Python code locally. You will be able to use Github.com and git to track changes to the code you write.

This document is available on the web; if you have a printed copy, you can see the URL on the last page. You can always refer back to it, or show it to other people.


Section 1: Accounts on the web

Time: 15 minutes, hopefully.

You're going to need accounts on:

  • Alwaysdata.com: This is a French web hosting company. Their free account level has Django support, so you'll use it to run your code and let other people access it over the web.
  • Github.com: This is the most popular hosting company for git, a popular version control system. You will use them to store versions of your code.

Alwaysdata account

Alwaysdata.com lets you create a free hosting account. You'll give them your name and email address and set a password that you'll use to log into the account.

Note! alwaysdata won't work with Internet Explorer 6. If you use IE6, let a staff member know.

  • Go to alwaysdata.com
  • Click Sign up now
  • Choose the "Pack gratuit (10 Mo)". It means "Free account (10 megabytes of storage)".
  • Choose the monthly payment plan.

On the back of this piece of paper, take a moment to write down the username, email address, and maybe password that you used to sign up for the Alwaydata.com account.

Github.com

Github.com is the most popular git-based service you can use to store files.

Go to http://github.com/ and create an account. You can choose whatever username you want. For now, just create an account, and then you can continue on through these setup instructions.

Testing

You might be itching to make sure you created these accounts properly. We'll test that later.

Section 2: Installing software

Now we're going to install Django, Python, git, and a text editor.

Click the link that matches your operating system.

Section 3: Configuring your accounts on the web

Alwaysdata: Enable SSH

  • Log into your Alwaysdata account at https://admin.alwaysdata.com/
  • In the left-hand side, underneath Remote access, click SSH
  • Click the gear icon for your user
  • Click the "Enabled" checkbox to enable ssh access. [hint: you can use a different passphrase than the SSH-key on localhost]
  • Click Submit!

Put your SSH key on Github

Follow Github's instructions:

To find your public key on Windows, type this from a GitBash:

notepad .ssh/id_rsa.pub

If you need help finding your SSH key, ask a volunteer. You're looking for a file called id_rsa.pub.

Make sure Git and Github are working together

Follow the instructions carefully; for example, do call your repository Hello World as they suggest.

If it worked, you'll see a new repository listed in your Github.com account, and it will have a README file explaining what it is.

Section 4: Deploying your first web application

Remember how you made a Django site earlier in the directions? The volunteers made a site like, too, and we added some special configuration to make it work well with Alwaysdata.com.

You're going to fork this git repository so that when make your own changes to it, you can push those changes to your personal Github account. (You have to fork the repository because otherwise Github won't let you make changes to "my" project!)

Fork our project on Github

Clone it to alwaysdata.com

  • Copy the "Git Read-Only" version of the repository URL to the clipboard (this is probably not the default, so be sure to click the "Git Read-Only" tab)
  • In your SSH client (PuTTY or ssh), connect to this host:
your_alwaysdata_username@ssh.alwaysdata.com
  • Enter this command into the terminal, but don't press enter yet:
git clone

Configure alwaysdata.com to serve your site

This is the last step: Tell alwaysdata.com how to serve up your site to the world.

  • Go to the Alwaysdata.com Domains administration page: https://admin.alwaysdata.com/domain/
  • Find your domain, and click the gear to edit.
  • Enter /workshop_mysite/public/ into the form as the Root directory:

Make sure alwaysdata.com is set up properly to serve your site

  • On the domain configuration page, grab the 'name' which is your personal alwaysdata.net web address.
  • Enter that into your browser's address bar (type or copy/paste). You should see the Django welcome page message congratulating you.

Almost Done!

Go to Web App Section of Friday's installation page and finish up!