Skip to content

Instantly share code, notes, and snippets.

@davidrios
Last active February 11, 2016 11:26
Show Gist options
  • Save davidrios/96ad6441fd185c98e33f to your computer and use it in GitHub Desktop.
Save davidrios/96ad6441fd185c98e33f to your computer and use it in GitHub Desktop.

10-minute guide to start Python web development on Windows

  1. Navigate on your web browser to https://www.python.org/downloads

  2. Click on Download Python 2.7.11

  3. Install the downloaded package using the default settings

  4. Open a terminal prompt: WindowsKey + R -> cmd.exe -> Enter

  5. Type: c:\python27\scripts\pip.exe install bottle

  6. Open windows explorer, navigate to your Documents folder, create a new folder called webdev1 and navigate to it

  7. Press Alt key on keyboard, click on File -> New -> Text Document

  8. Name your new file test1.py and open it with a text editor, standard notepad will do, but you will not be able to edit it by double-clicking on the file

  9. Insert the following code in the file:

     from bottle import route, run, template
    
     @route('/hello/<name>')
     def index(name):
         return template('<b>Hello {{name}}</b>!', name=name)
    
     run(host='localhost', port=9090)
    
  10. Double-click on the test1.py file to run it, a prompt window should appear with a text like Bottle v0.12.9 server starting up... etc

  11. Navigate on your web browser to http://localhost:9090/hello/world

  12. Enjoy your first Python web application!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment