Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # 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
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement