So I am learning Python Web programming using Putty and Flask. I have set up server and did some Flask backened set up. I have created __init__.py
file with "Hello World" as a test. So If I open my website address in browser I should see simple Hello World. But when I open my website it shows content that is inside index.html file.
Here's the code for my __init__.py
file:
from flask import Flask
app = Flask(__name__)
@app.route('/')
def homepage():
return "Hello World"
if __name__ =="__main__":
app.run()
Code for flaskapp.conf
<VirtualHost *:80>
ServerName *****website.com
ServerAdmin ***********
ServerAlias www.*****website.com
WSGIScriptAlias / /var/www/flaskapp/flaskapp.wsgi
<Directory /var/www/flaskapp/flaskapp/>
Order allow,deny
Allow from all
</Directory>
Alias /static /var/www/flaskapp/flaskapp/static
<Directory /var/www/flaskapp/flaskapp/static/>
Order allow,deny
Allow from all
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
LogLevel warn
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
code in flaskapp.wsgi
#!/usr/bin/python
import sys
import logging
logging.basicConfig(stream=sys.stderr)
sys.path.insert(0,"/var/www/flaskapp")
from Flaskapp import app as application
application.secret_key = '*********'
If you need any other information please let me know.
Any help will be much appreciated, thank you
Aucun commentaire:
Enregistrer un commentaire