datadesk / django-bigbuild

The open-source engine that powers bigbuilder, the Los Angeles Times Data Desk's system for publishing standalone pages
http://www.latimes.com/projects/
MIT License
24 stars 0 forks source link

allow data imports from data folder or absolute path #37

Closed anthonyjpesce closed 7 years ago

anthonyjpesce commented 7 years ago

Half baked idea, but I have a reason today to want to import a JSON file as context data I also want to have built from the static directory.

You could add a check here: https://github.com/datadesk/django-bigbuild/blob/master/bigbuild/models/pages.py#L139

Alternate idea would be to have a flag to bake out the data files to make them available publicly (similar to what we did on the graphics site with the .json extension).

palewire commented 7 years ago

Interesting idea. I hadn't considered that use case before.

As I think about it, maybe there isn't a need for the distinction between the data folder and the static folder. I could imagine deprecating the data folder entirely and having it draw in files from the static folder to the context instead.

palewire commented 7 years ago

I wonder if we could simply require a "full path" to the data file like "data/results.csv" or "static/results.csv" and trust the user to figure out where they want to put it. If you want it live in static folder, just go for it.

anthonyjpesce commented 7 years ago

I like that idea, and the app is just less opinionated about your directories which is (usually) kind of nice

palewire commented 7 years ago

Shipping this now.