0

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

Shanteshwar Inde
  • 1,438
  • 4
  • 17
  • 27
Evgenis
  • 33
  • 4
  • @ShanteshwarInde yes – Evgenis Apr 30 '19 at 06:11
  • Have you followed the official flask [quickstart tutorial](http://flask.pocoo.org/docs/1.0/quickstart/)? The setup there looks a bit different from yours (quite a lot simpler, to be honest), and shows how to define flask's entrypoint via the `FLASK_APP` environment variable. – Arne Apr 30 '19 at 06:35

0 Answers0