Advertisement
Guest User

Untitled

a guest
Feb 10th, 2016
46
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.11 KB | None | 0 0
  1. # 10-minute guide to start Python web development on Windows
  2.  
  3. 1. Navigate on your web browser to https://www.python.org/downloads
  4. 2. Click on Download Python 2.7.11
  5. 3. Install the downloaded package using the default settings
  6. 4. Open a terminal prompt: WindowsKey + R -> cmd.exe -> Enter
  7. 5. Type: c:\python27\scripts\pip.exe install bottle
  8. 6. Open windows explorer, navigate to your Documents folder, create a new folder called webdev1 and navigate to it
  9. 7. Press Alt key on keyboard, click on File -> New -> Text Document
  10. 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
  11. 9. Insert the following code in the file:
  12.  
  13. from bottle import route, run, template
  14.  
  15. @route('/hello/<name>')
  16. def index(name):
  17. return template('<b>Hello {{name}}</b>!', name=name)
  18.  
  19. run(host='localhost', port=9090)
  20. 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
  21. 11. Navigate on your web browser to http://localhost:9090/hello/world
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement