Forums

The server displays the previous hello world welcome application instead of the current one

The server displays the previous hello world welcome application instead of the current one. The hello world application files has been deleted but problem persist showing te "hello from flask"

These are the directories path:

  • /home/pysoft/pythonProject
  • /home/pysoft/
  • WSGI configuration file:/var/www/pysoft_pythonanywhere_com_wsgi.py

...and the configuration for wsgi:

import sys

# add your project directory to the sys.path
project_home = '/home/pysoft/pythonProject'
if project_home not in sys.path:
    sys.path = [project_home] + sys.path

# import flask app but need to call it "application" for WSGI to work
from runserver import app as application  # noqa

according to the instructions, if I have understood them correctly, everything is correct. Although it does not give errors and shows an application, the application that shows is the welcome one that, as I said, I even deleted it.

I don't know what I haven't done well :(

[edit by admin: formatting]

What do you have in the file /home/pysoft/pythonProject/runserver.py?

When I opened the runserver.py file I was surprised, but that explains this magical output "hello world":

# A very simple Flask Hello World app for you to get started with...

from flask import Flask

app = Flask(__name__)

@app.route('/')
def hello_world():
    return 'Hello from Flask!'

...when in my local directory the content of runserver.py is:

from flask import render_template, request
from . import create_app

app = create_app()


@app.route('/', methods=['GET', 'POST'])
def upload_file():
    if request.method == 'POST':
        # verify if the file is valid
        # here invoke js to do something (for example flash("test"))
        return render_template('upload.html', flash_message="True")

    return render_template('upload.html', flash_message="False")

it just seems that the code has been overwritten, I have uploaded this file again to correct it,

Thanks for your guidance, now that I am new to the platform it seems that these errors can be very common :)

Glad to hear that you made it work!