hey all, I am trying to understand how static files work in a nested directory, e.g. my webapp will be stored at example.com/nested/website/<appdir>
kzuraw joined the channel
woltman has quit
eggstyrone joined the channel
contracode
Ryanar: In production, it all depends on what's hosting your static files-- nginx, redis, or what-have-you
its being served with apache using a fastcgi script
tbaxter
Ryanar: IMO (and I hate second-guessing Kenneth) no
amcorreia joined the channel
IMO, nginx is by far the best way to handle static assets
kennethreitz
false, a CDN is is :)
pjs
contracode did you just say redis... hosting static files? whaaa?
sp1rs joined the channel
cdn++
tbaxter
kennethreitz: Well... maybe.
meoblast001 joined the channel
:-)
Hairy has quit
kennethreitz
if you're going to do it right, do it right :)
otherwise, having python serve them is fine
eieste_ joined the channel
EduardoMartins joined the channel
Ryanar
kennethreitz: woah you are here :O
kennethreitz
obviously having nginx handle it is better, if you're okay with the configuration overhead
tbaxter
well, a CDN only helps if you're in cache and/or it can outperform your local serving AND you give up fine-grained request control. So in theory it's fastest, but in practice it may not be.
mekhami
Ryanar: i get star struck every time he comes around too @.@
kennethreitz
almost always best practice if truly want to treat your static requests differently than your dynamic ones
they're all just requests
Ryanar
i mean for my purposes I don't see performance suffering all that much, it will be a really low visitors site
kennethreitz
if you want to get them out of the python process, might as well get them off of the box entirely
tbaxter
I'm not going to argue with you when it comes to requests :-D
kennethreitz
but most people don't have a need to do either, and over-optimize
tbaxter
Ryanar: honestly, you'll be fine. personally,I'd keep them out of django, and since I have an nginx front-end already, that's handy. But if you're using apache, you can have it serve them and that will work great too
c17r joined the channel
Ryanar
yeah I have my apache script set up to serve them
Hairy joined the channel
moldy
Ryanar: you should maybe also consider whitenoise
Ryanar
I think the biggest hiccup I run into is going from localhost testing to my dev server because I am serving files with django's static
tbaxter
Ryanar: then IMO, you're fine.
Ryanar
on my localhost
kennethreitz
yes whitenoise is much better than dj-static
raijin has quit
one came after the other :)
rando305
Quick question. Is there a setting in django admin to low an element in an inline form to be selectable so that I could go directly to that items change form? I'm at a loss for the language to search for this feature.
to allow
moldy
i think people are often optimizing horizontally when they should optimize vertically
amrtanair has quit
tbaxter
rando305: i once subclassed inlines to do that.
moldy
(not sure if these are the right terms)
amrtanair joined the channel
no matter how little traffic your site gets, your few users will appreciate it if you optimize response times, http requests and such.. it just "feels" better
rando305
tbaxter, oooh... I don't think I am there yet...
cleder has quit
tbaxter, any search terms suggestions so that I might look around for it?
kennethreitz: hmm, i guess so, though i must think a little about the "predictable" part :)
Ryanar
does anyone know any resources for learning django above a beginner level? I am looking for best practices on building reusable apps, how to correctly move to production deployment, testing (I have the o'reilly book on TDD in django), etc. don't mind if they aren't free
mekhami
mastering django is good
kennethreitz
moldy scalable means you have consistent performance characteristics
moldy
Ryanar: two scoops of django is widely considered good, and it is pretty up-to-date
acallahan has quit
kennethreitz: hmm, right.
nimomo has quit
Ryanar: in the end, no book will completely substitute personal experience. the sad truth about deployment practices is that they are best described as "still evolving" :p
Ryanar
yeah I saw two scoops, perusing the chapters though it seems like most of the material I have covered, though a few sections would be worthwhile to own it
I want to say you can specify a custom template in the admin definition. Maybe. It's been a long time.
Ryanar
tbaxter: yeah I find the docs lack some of the info I want though, in general it gives me the overall concept but then I am left to figure the rest out for myself and I am not sure what the best practices are
kyheo has quit
rando305
tbaxter, Brilliant. I'll poke around at that. Greatly appreciate the guidance.
moldy
"best practices" depend on individual context very much
tbaxter
uh, not sure how much guidance is there... I'm missing half of it, and don't know if the remaining half still works
i thought you could do something like this {% if product.quantity < 1.3 * product.today %} but i get errors
Hairy has quit
moldy
Ryanar: and obviously, if you decide to go with heroku or such, then many deployment questions turn into non-questions for you. so that is one decision you should make early.
Ryanar: for reuseable apps, one hint i can give is: avoid concrete models as much as possible
Ryanar
concrete models meaning?
MJR_ joined the channel
moldy
Ryanar: concrete means "not abstract"
rando305
I used someone's setup for getting my production system up and running. (It was out of date and required using the developer as a consultant). It was definitely worth the effort. I can give you connections if you would like.
Ryanar
moldy: I am now enlightened :P
xall has quit
rando305
moldy, your comment reminds me of "Special cases aren't special enough to break the rules. Although practicality beats purity."
moldy
Ryanar: and then you need to decide if you want continuous integration, or how much of it you want, and yadda yadda... hard to come up with a general answer
rando305: which comment?
rando305
best practices
moldy
rando305: i once read somewhere that "in operations, context is everything"
MJR_
Hi every one. I want to know what is the best way to store media files on another server? currently my idea is to store files on remote server and mount that directory in my server and point media_root to this mounted directory. is that seems ok?
hylje_
i'm pretty sure there's a media storage backend that knows how to deal with remote servers
ScutulatIum joined the channel
rando305
moldy, I spent this week explaining why my 'backfitting current operations' was a more difficult task than a consultant setting up a greenfield application. I have to change everything while the train is running.
xall joined the channel
moldy
rando305: can you use heroku? what availability level do you need? what kind of load do you want to handle? how many developers are on your team? how much will you work on this application after the first deployment? these are not "special cases".
Ryanar
moldy: well I know that I need to deploy using apache and a fastcgi script to activate the django app, if its not used for awhile it 'goes cold', I have mysql or sqlite3 for db choices, and I guess I could hook up circleci or something, but I need to build the test suite first :P
moldy
but they do have a lot of impact on what the "best practice" is
Ryanar: so, now we are talking. fasctcgi is pretty much *not* a best practice, afaik :)
acangiani has quit
rando305
MJR_, On my AWS machine, I mounted a seperate volume and did that. It works well (most of the time). Collectstatic sometimes gets confused and wants to copy everything locally so use the symbolic link option for that.
fission6
where is the add template tag declared
Ryanar
moldy: well im not sure what other options I have
moldy
Ryanar: so you don't have the authority to decide about the deployment environment? in that case, can you maybe beg for mod_wsgi?
zz_sebcorbin is now known as sebcorbin
Ryanar
i can beg, and no I don't have authority about my deployment environment unfortunately :(
moldy
Ryanar: beg really hard for mod_wsgi ;)
Ryanar
and our IT team doesn't support Django, so everything I ask for is like ~.~
MJR_
rando305: Actually I'm fine with static files resides on my local server. I Just want my upload and downloads in another download host. then you think it should works ok?
dvschramm joined the channel
moldy
Ryanar: the other approach: run gunicorn and ask them to proxy to it
toothe has left the channel
rando305
MJR_, I'm not able to say. I'm still a wee lad in this.
lacrymology has quit
subho has quit
moldy
Ryanar: in the end, they *must* "support" django in one way or another, otherwise it won't work at all
ScutulatIum has quit
Ryanar
I have read a bit about gunicorn but I don't know what it does
MJR_
rando305: ok thanks. just one question, did you use that directory only for static files or for media files as well?
Ryanar
or what it is
ill go read up on it
moldy
Ryanar: it's a web server for wsgi apps. every django project is a wsgi app.
Ryanar
website gateway interface, I got that one at elast
least* :P
Hairy joined the channel
sebcorbin is now known as zz_sebcorbin
rando305
MJR_, media files. (videos and uploaded documents)
collinanderson has left the channel
moldy
Ryanar: maybe you can just use heroku? does it absolutely *have* to run on your in-house infrastructure?