eudicots/Cactus

STATIC_URL ?

dzone-IP opened this issue · 6 comments

I've attempted creating a settings.py file, and placing STATIC_URL in default.py as well with no success.

I'd like to specify the production location of the static content different from where the site will be hosted.

The static tag and STATIC_URL (now deprecated) context variable only support statics that are within the project.

If you're okay with python and running your own fork, you'd modify template_tags.py.

I would suggest including a config entry static-url: << base url for external statics >>' and then enhancing the template_tags.static method by replacing the existing line:

    url = site.get_url_for_static(link_url)

With the following conditional:

    if site.config.get('static-url'):
        url = site.config.get('static-url') + link_url
    else:
        url = site.get_url_for_static(link_url)

Deprecated… maybe I’m going about this wrong.

What would be the proper way to configure all the static content ending up
on one domain and the pages to another, while still maintaining the quick
build and asset checking of the local dev environment?

For example, site would live at www.monkey.com and static files would end
up being pushed to cdn.llama.com.

Obviously I’m not using S3 deployment and will just be exporting and FTP
manually.

Btw, thanks for responding at all!

On Wed, Feb 17, 2016 at 3:47 PM, Dwight Gunning notifications@github.com
wrote:

The static tag and STATIC_URL (now deprecated) context variable only
support statics that are within the project.

If you're okay with python and running your own fork, you'd modify
template_tags.py.

I would suggest including a config entry static-url: << base url for
external statics >>' and then enhancing the template_tags.static method
by replacing the existing line:

url = site.get_url_for_static(link_url)

With the following conditional:

if site.config.get('static-url'):
    url = site.config.get('static-url') + link_url
else:
    url = site.get_url_for_static(link_url)


Reply to this email directly or view it on GitHub
#236 (comment).

The STATIC_URL tag has been deprecated for quite a while in the python app. It still works and probably won't disappear anytime soon as far as I can tell (I'm not part of the core committer group so not entirely sure of their plans).

In order to achieve what you're looking for you, you'll need the customisation I suggested above. Alternatively you could hard code all your static paths as absolute URLs. I understand that's not ideal but nothing else comes to mind immediately.

Just to clarify - are you using the OS X app or just pip installing the python package? If the latter, we should be able to get you going with what you need independently of the core team.

Using the OS X ‘Cactus for Mac’ app; I’m not opposed to installing
something else.

Not traditionally a python developer but a new syntax wouldn’t be the end
of the world.

Where is the template_tags.py file? Instead the Cactus App Package?

I appreciate your help Dwight!

On Wed, Feb 17, 2016 at 5:29 PM, Dwight Gunning notifications@github.com
wrote:

The STATIC_URL tag has been deprecated for quite a while in the python
app. It still works and probably won't disappear anytime soon as far as I
can tell (I'm not part of the core committer group so not entirely sure of
their plans).

In order to achieve what you're looking for you, you'll need the
customisation I suggested above. Alternatively you could hard code all your
static paths as absolute URLs. I understand that's not ideal but nothing
else comes to mind immediately.

Just to clarify - are you using the OS X app or just pip installing the
python package? If the latter, we should be able to get you going with what
you need independently of the core team.


Reply to this email directly or view it on GitHub
#236 (comment).

Doh, yup found. Thanks man, I’m going to start forkin’ around!

-a

On Wed, Feb 17, 2016 at 5:41 PM, Abbie Mashaal abbie@dzoneskydiving.com
wrote:

Using the OS X ‘Cactus for Mac’ app; I’m not opposed to installing
something else.

Not traditionally a python developer but a new syntax wouldn’t be the end
of the world.

Where is the template_tags.py file? Instead the Cactus App Package?

I appreciate your help Dwight!

On Wed, Feb 17, 2016 at 5:29 PM, Dwight Gunning notifications@github.com
wrote:

The STATIC_URL tag has been deprecated for quite a while in the python
app. It still works and probably won't disappear anytime soon as far as I
can tell (I'm not part of the core committer group so not entirely sure of
their plans).

In order to achieve what you're looking for you, you'll need the
customisation I suggested above. Alternatively you could hard code all your
static paths as absolute URLs. I understand that's not ideal but nothing
else comes to mind immediately.

Just to clarify - are you using the OS X app or just pip installing the
python package? If the latter, we should be able to get you going with what
you need independently of the core team.


Reply to this email directly or view it on GitHub
#236 (comment).

I'd recommend getting yourself setup with virtualenv which will isolate the python environment for this "project" from the global python runtime that OS X installs and manages.

From there just fork and update template_tags.py and include the additional configuration setting.

Here's a gist.

You can even submit a PR back to @krallin since there's already a #TODO in the codebase asking for this sort of change.