Closed willkg closed 10 years ago
The word "static" is ambiguous. We should rename "staticrender" to "compile" and related configuration settings to "compile_".
Then implement static_url and static_dir for static assets.
Redid all the static rendering stuff so it's now called "compiling". Now "static" isn't ambiguous anymore. Next step is to implement static file handling for when you're compiling your blog.
Reducing the scope of this to just compiled blogs. I'll spin off another issue to cover running Douglas as a WSGI app.
Creating two new config variables: static_url
and static_files_dirs
.
The first serves two purposes. First, you can use it in your templates like {{ static_url }}/css/somefile.css
and then your templates have static assets all rooted in the right place. Second, if the value starts with http
then douglas-cmd compile
will see that as a sign that you're using a CDN and not copy your static files over to your compiled dir.
The second is the list of directories to copy static files from. The example config file will start this with BLOGDIR + 'static/'
so any files in that directory will be copied over.
Further, the compiler will also copy any static/
directories in the themes dir that it finds.
So if you have a directory structure like this:
blog/
static/
foo.jpg
bar.css
themes/
html/
static/
html/
header.jpg
htmltheme.css
Then you end up with the following:
blog/
compiled_site/
static/
foo.jpg
bar.css
html/
header.jpg
htmltheme.css
This allows a couple of things:
This probably also needs a douglas-cmd collectstatic
command which will collect and copy over static files to a specified location. Then you can more easily collect and upload all your static files to a CDN mount point or something like that. I think I'm going to make that outside the scope of this issue and deal with it in a different issue when someone needs something like this.
Outstanding work here:
static/
directory to relevant themesOh, one other thing: need to figure out how to use static files in blog entries. For example, I write a blog entry that has a picture of a cat in it. Where does that image go? How do I reference that image in my blog entry? What kind of cat should it be? Should we allow long-hairs?
Finished!
There's no good way to deal with static assets right now. That needs to get fixed.
There are two scenarios for this:
static/js/
,static/css/
, ...static()
function that generates static urls.