It's not a very common use case, but yes you could do that. Hugo is a static site generator, so you can upload the static files and host them on PythonAnywhere: https://help.pythonanywhere.com/pages/hosting-a-static-site/. There are other services that are likely better suited for hosting a site like that.
Some users have used Pelican, which is written in Python, as a static site generator on PythonAnywhere. I'm not sure if it's as easy to set up though.
Okay got it, so hosting static files on pythonanywhere, and setting up Hugo on something like another cloud service? Or is it possible to also setup Hugo here?
Nice, thanks for that suggestion, I will take a look at it.
You can run Hugo on PythonAnywhere, it's just a single binary file as far as I know. See https://gohugo.io/installation/linux/#prebuilt-binaries
Oh that's pretty neat. Just a question -- Does that mean even if I install this to actually serve the sites I would have to use either Django or Flask in web app section? I am having a hard time understanding how it would work from me setting it up to PythonAnywhere showing these static generated sites.
No, you can serve a static site on PA without a framework overhead, see this help page.
In the link you have provided it is mentioned:
Then, on the Web tab configuration screen, scroll down to the Static Files section, and add one new entry:
URL: / Path: /home/yourusername/path/to/your/static/site
The file structure made by Hugo is as follows:
soulreaper
├── archetypes
├── assets
├── content
│ ├── about
│ ├── books
│ │ ├── Database_Design_for_Mere_Mortals
│ │ └── nosql_for_mere_mortals
│ └── posts
├── data
├── i18n
├── layouts
├── public
│ ├── about
│ ├── archives
│ ├── assets
│ │ ├── css
│ │ └── js
│ ├── books
│ │ ├── Database Design for Mere Mortals
│ │ ├── databaseDesign for Mere Mortals
│ │ ├── database_design for Mere Mortals
│ │ ├── database_design_for Mere Mortals
│ │ ├── database_design_for_Mere Mortals
│ │ ├── database_design_for_mere_mortals
│ │ ├── nosql_for_mere_mortals
│ │ ├── page
│ │ └── the_relational_database
│ ├── categories
│ │ ├── async
│ │ ├── python
│ │ ├── syntax
│ │ └── themes
│ ├── en
│ ├── fa
│ │ ├── facategories
│ │ ├── faseries
│ │ ├── fatags
│ │ └── page
│ ├── fr
│ │ ├── frcategories
│ │ ├── frseries
│ │ └── frtags
│ ├── page
│ │ └── 1
│ ├── post
│ ├── posts
│ │ ├── page
│ │ └── post
│ ├── resume
│ │ ├── page
│ │ └── resume
│ ├── search
│ │ └── page
│ ├── series
│ ├── tags
│ │ ├── async
│ │ ├── code
│ │ ├── first
│ │ ├── gist
│ │ ├── markdown
│ │ ├── python
│ │ └── syntax
│ └── the_relational_database
├── static
└── themes
└── PaperMod
├── assets
├── i18n
├── images
└── layouts
I am guessing I would need to add "pubic" and "static" folders to the static path in the web app?
The static path contains some custom html and icons and stuff. The public folder seems to contain all the helping html, css, and js code.
edit: oh nevermind, looks like the "public" folder has everything. So I would just need to add the "pubic" folder to the static path?
Yes, I think for hugo
adding public
directory should be enough.
Nice one. I will experiment with this a bit and see what happens. Thanks!
Cool, good luck!
Just a small update, it works! It's pretty plug and play -- I essentially just run the hugo
command, let it build the folder, and then added that folder to path as suggested by the static host page you guys suggested.
Thanks for the update!