librelist archives

« back to archive

Lots of static files

Lots of static files

From:
Juancarlo Añez
Date:
2012-06-23 @ 19:07
Which is the best strategy for deploying a site in which much of the
content is static?

I'm particularly interested handling this scenario on Heroku.

Thanks in advance,

-- 
Juancarlo *Añez*

Re: Lots of static files

From:
Juancarlo Añez
Date:
2012-06-24 @ 03:08
This is the solution I adopted.

On top of the Flask-Heroku template at
https://github.com/zachwill/flask_heroku, I added the static files under
./static/site, and changed app.py to read:

@app.route('/')
def home():
    return app.send_static_file('site/index.html')


@app.route('/<path:path>')
def site(path):
    return app.send_static_file('site/' + path)

@app.route('/about/')
def about():
    """Render the website's about page."""
    return render_template('about.html')


It does exactly what I needed, i.e., if there isn't a specific route to
tend to the request (like /about/), the corresponding file in static/site
is served. Furthermore, the solution is portable to any WSGI hosting
service (like Google AppEngine).

It seems fair that I explain why I had this requirement:

A client contacted me about rewriting a Drupal site from scratch, with the
same design, and I thought it was silly to just throw away what was already
done (nevermind the mess Drupal creates). I thought that if  I could render
the existing site files statically, the project would consist on the
interactive and dynamic aspects only.

It worked.

Regards,

On Sat, Jun 23, 2012 at 2:37 PM, Juancarlo Añez <juancarlo.anez@gmail.com>wrote:

>
> Which is the best strategy for deploying a site in which much of the
> content is static?
>
> I'm particularly interested handling this scenario on Heroku.
>
> Thanks in advance,
>
> --
> Juancarlo *Añez*
>
>


-- 
Juancarlo *Añez*

Re: [flask] Lots of static files

From:
Kenneth Reitz
Date:
2012-06-23 @ 21:22
I highly recommend checking out the static wsgi app: 
http://lukearno.com/projects/static/

--  
Kenneth Reitz


On Saturday, June 23, 2012 at 3:07 PM, Juancarlo Añez wrote:

>  
> Which is the best strategy for deploying a site in which much of the 
content is static?
>  
> I'm particularly interested handling this scenario on Heroku.
>  
> Thanks in advance,
>  
> --  
> Juancarlo Añez
>  

Re: [flask] Lots of static files

From:
Rahul R
Date:
2012-06-23 @ 20:56
The only thing that comes to my mind is NGinx <http://wiki.nginx.org/Main>

--Rahul

On Sun, Jun 24, 2012 at 12:37 AM, Juancarlo Añez
<juancarlo.anez@gmail.com>wrote:

>
> Which is the best strategy for deploying a site in which much of the
> content is static?
>
> I'm particularly interested handling this scenario on Heroku.
>
> Thanks in advance,
>
> --
> Juancarlo *Añez*
>
>