(Aug-23-2017, 12:25 PM)AhmadMWaddah Wrote: or i need to install server like i did in (( LAMP )).
No,you do not need LAMP,WAMP,XAMPP...ect at all.
Here is basic setup you can try:
pip install Flask
Folder setup:
my_page\
|-- app.py\
templates\
|-- index.html
|-- about.html
static\ # CSS,JS,images ..ect goes in here in own folders
Files:
app.py
from flask import Flask, render_template
app = Flask(__name__)
@app.route('/')
def index():
return render_template("index.html")
@app.route('/about')
def about():
return render_template("about.html")
if __name__ == '__main__':
app.run(debug=True)
index.html
<!doctype html>
<html>
<head>
<title>Some title</title>
<link rel=stylesheet type=text/css href="{{ url_for('static', filename='css/style.css') }}" />
</head>
<body>
<div id="start">
<h1>Start page</h1>
<ul>
<li class="page_1"><a href="/about">About</a></li>
</ul>
</div>
</body>
</html>
about.html
<!doctype html>
<div class="foo">
<h1>The About Page</h1>
<a href="http://flask.pocoo.org/">Learn Flask</a>
</div>
Now have a basic setup and can test it out.
Run
python app.py
this start the build in web-server.
In browser
http://127.0.0.1:5000/
So now should see index page with a link to about page.
Quote: For production use Apache, Nginx or some Twisted built custom server.
Yes that right,and some host do all all server setup,so only need to upload files.
A quick overview over host that a posted.
PythonAnywhere: they to all server setup(they use uWSGI and Nginx).
All that is required of you is to upload files
git clone repo
on there command is the recommend way.
Can also use there web interface to upload files.
AWS Lambda: lets you run code without provisioning or managing servers.
You pay only for the compute time you consume.
Digital Ocean you are the boss over everything,start from blank distro eg Ubuntu.
You do all server setup,here i prefer
Gunicorn and
Nginx(not Apache).
Heroku: Only setup Gunicorn,they setup Nginx.