So I've been trying to deploy my flask website to the public, but it's been quite annoying to say the least. I'm finished with my website and it runs on the localhost. However, when I try to use the frozen-flask module, as suggested by a tutorial I saw on Medium.com, to "freeze" my html files into static files so I can have a static website (I made a personal website), I get an error in my freeze.py file. Here's the code for it:
from flask_frozen import Freezer
#main.py is the python file where I created my app
from main import app
freezer = Freezer(app)
if __name__ == '__main__':
#This is the line that appears to be giving me the error when I run the code from the terminal.
freezer.freeze()
That Medium.com tutorial only used 1 html file and no css (just a basic hello world application), so I have no clue if that would change anything, as I have several html files and a main.css file. Also, when I run "python freeze.py" in the terminal, it creates a directory in my project named "build" (as expected) but underneath the directory, it creates several other directories, named after all my html files. Underneath those directories, it has a file called "index.html" (for ALL of the directories). The files look something like this because I know that explanation wasn't too good. For some reason, this didn't happen when I initially used flask-frozen, it just created a bunch of files named after my html files, with no unnecessary extra directories.
- Name of project
- build
- name of one of my html files
- index.html
- name of one of my html files
- index.html
etc...
If anyone knows why this happens, or if I even need to frozen-flask to deploy my personal website (please, god, let there be a better approach), it would be greatly appreciated if I could know. I'm trying to use Netlify if that helps at all (seems to be much more straight forward than other platforms like Heroku).
Aucun commentaire:
Enregistrer un commentaire