Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
How important is the file structure (templates and static folder) in the package of a Pyramid Project
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  2 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Raj Nathani  
View profile  
 More options Sep 23 2012, 12:43 pm
From: Raj Nathani <raj_...@hotmail.com>
Date: Sun, 23 Sep 2012 09:43:42 -0700 (PDT)
Local: Sun, Sep 23 2012 12:43 pm
Subject: How important is the file structure (templates and static folder) in the package of a Pyramid Project

Hey I'm kind of new to Pyramid and web frameworks in general. One of the
things I've learnt so far is that every Pyramid project created with a
starter
scaffold has a package in which there are two folders - templates and
static.

Is it necessary to keep the structure this way? Would the whole thing work
fine if the folders were renamed/in-existent (with template and static files
out one level higher in the projects root folder instead)? I'm pretty sure
it isn't. But that
brings me to my next question, which is about the 'static' folder, I've
seen calls from python scripts within the project which declare in some of
way that 'static' content is served from 'static' folder. How does this
help?
Does Pyramid have a different and faster way of serving files which it
knows are static?


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Mike Orr  
View profile  
 More options Sep 23 2012, 3:23 pm
From: Mike Orr <sluggos...@gmail.com>
Date: Sun, 23 Sep 2012 12:23:44 -0700
Local: Sun, Sep 23 2012 3:23 pm
Subject: Re: How important is the file structure (templates and static folder) in the package of a Pyramid Project

On Sun, Sep 23, 2012 at 9:43 AM, Raj Nathani <raj_...@hotmail.com> wrote:
> Hey I'm kind of new to Pyramid and web frameworks in general. One of the
> things I've learnt so far is that every Pyramid project created with a
> starter
> scaffold has a package in which there are two folders - templates and
> static.

> Is it necessary to keep the structure this way? Would the whole thing work
> fine if the folders were renamed/in-existent (with template and static files
> out one level higher in the projects root folder instead)? I'm pretty sure
> it isn't.

The main issue is specifying the paths.  "myapp:templates/...", or
"templates/...", depends on the directory being inside a Python
package. MyApp/myapp is an importable Python package. MyApp isn't.
You'd have to create a relative path using __file__, or specify an
absolute path, and I'm not sure if these are compatible with
add_static_view() or renderer= anyway.

> But that
> brings me to my next question, which is about the 'static' folder, I've
> seen calls from python scripts within the project which declare in some of
> way that 'static' content is served from 'static' folder. How does this
> help?
> Does Pyramid have a different and faster way of serving files which it
> knows are static?

No, it's a convenience for the developer. The scaffolds predefine a
view for URL "/static" pointing to "myapp:static".  That provides a
place for all static files to go, without the developer having to
define a view and a directory. You can of course have multiple static
directories for different purposes.

The fastest way to serve static files in production, is to arrange for
the main webserver (Apache) to serve the static directory directly
rather than passing those requests to the application.

--
Mike Orr <sluggos...@gmail.com>


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »