Home > database >  Creating HTML files within Web Application but HTML files are not updated
Creating HTML files within Web Application but HTML files are not updated

Time:12-27

I'm developing a flask web application which is hosted on Heroku. Part of the back-end process is writing to HTML files/pages that the user is currently on. For example,

{{% extends "base.html" %}}
{{% block title %}}
{self.title}
{{% endblock %}}
{{% block content %}}
<br>
<h1>{self.title}</h1>
<div>
    <form action="#" method="POST">
        {self.content}
        <div>
            <button type="submit" name="action" value="Generate PDF">Generate PDF</button>
        </div>
    </form>
</div>

Where self.content is updated according to user input, thus updating the file.

On the development server this works fine, however, when the app is deployed this instantly updating process no longer works.

I don't really understand why

Thanks for any and all help!

CodePudding user response:

The relationship between heroku and GitHub was preventing the instantaneous update from occurring when the application was deployed. That is, the application would make changes to the code which would have to be pushed through manually instantaneously.

To fix this, I generalised some html files such that self.content was fed in through the back-end and no file writing or creation occurred.

Later realised that writing to files in web applications is bad practice!

  • Related