no I am thinking of deleting my doings and starting again correctly
gugah joined the channel
aossama has quit
FunkyBob
tuskkk___: well, mine starts from "setting up your DigitalOcean droplet"...
jwhisnant joined the channel
I should give it a refresh some time soon, in fact
especially now debian9 is out
Wooble
tuskkk___: it's typical to do development with the "standalone" django server anyway, no need to delete anything. The same codebase should run under a real webserver and the dev server.
Wooble: what happened was, I already had everything under a venv, then from one of the tutorials, I also installed VirtualEnvWrapper, so now I have two venvs, with no idea how to correctly create the uwsgi sock. My nginx is setup though, I have had past experience with it.
Tadassssss
oh man the setup of django... spent 2 days to setup that, good luck, most of the tutorials are either outdated or miss some parts and you end up spending 3 hours debugging
+FunkyBob, you asked for the code, https://dpaste.de/AbAF. but still cant get it subtract the date correctly
zhalla has quit
ChrisWarrick
Tadassssss: set up what? django for dev or for serving?
Tadassssss
for all, for beginners I'd say it is difficult and even some tutorials on digitalocean miss some parts
ChrisWarrick
tutorials on digitalocean are usually crap
Tadassssss
yeah, figured that out already
ChrisWarrick
written by people who can’t even get themselves a blog
Tadassssss
anyways, please ChrisWarrick, you are the master of python, check my code https://dpaste.de/AbAF, I want to get the date difference
date difference from now minus timestamp on last sql row inserted
dbinoj has quit
jhfisc joined the channel
fpghost84 joined the channel
dang`r`us
wreed, database doesn't know what safe text is so no, you can't do that.
ChrisWarrick
Tadassssss: try printing it before returning it? Format it? (and you don’t need @property)
dang`r`us
wreed, SafeText just means it's a string that has been flagged as safe.
jhfisc has quit
I suppose you can store that flag as a boolean, if you really need to differentiate between SafeText and regular old strings
make it a separate field then
wreed
i dont really need to since users cannot send notificaitons (they are only from the server) i just thought it would be extra careful to only mark the ones with desired html in it as safe but i guess it doesnt really matter
Hello all. I'm noticing some strange behavior with django - I'm rendering a static html file I have, that I put in a directory called app, with the render_to_response function. However, if I change the name of the app directory (and subsequently change the path in my render_to_response call) I get a TemplateDoesNoteExist exception. Is the app directory special somehow?
wreed has quit
hylje
harwiltz: is your renamed app in INSTALLED_APPS?
jhfisc has quit
harwiltz
hylje: I don't think I ever edited INSTALLED_APPS, lemme check
that's in settings.py?
hylje
yes
being installed is special, not the app package itself
harwiltz
I have neither the new directory name or 'app' in there
The only edit I made to that is the addition of staticfiles
dang`r`us
staticfiles has nothing to do with rendering templates
different dir
Itkovian has quit
greg_f joined the channel
thaxy joined the channel
harwiltz
dang`r`us: Yeah that's my point, that's why I'm so confused as to why my app/index.html renders but not testdir/index.html
AFAIK, I refactored all instances of app/
bullicon has quit
theparadoxer02_ joined the channel
bullicon joined the channel
rougeth
Hello friends, the dj1.8 docs says about custom managers "If you override the get_queryset() method and filter out any rows, Django will return incorrect results."
dang`r`us
harwiltz, did you check out the tutorial? your templates go in app_name/templates/app_name
rougeth
why is thtat?
dang`r`us
so app 2 can override app 1
as in app_2/templates/app_1
anyway, do the tutorial :)
harwiltz
dang`r`us: Alright sure, but I have no templates directory
And why should it matter where the html is stored anyway? I'm sending data from the server to the front end, it's not like is if it has to host my html somewhere. Is there a way I can put my HTML in an HttpResponse?
Without writing it out in my python source, of course
I always have to do Model.objects.filter(disabled=True), can I override get_queryset on my manager to do this filter there?
schinckel
Also, go to bed.
FunkyBob
:)
schinckel
rougeth: Consider having more than one manager on your model. Because otherwise you'll _never_ be able to get the disabled objects.
Unless you _really_, _really_ don't ever need them. And then maybe create a manager to access them anyway.
harwiltz
FunkyBob: I know, but I'm not actually rendering a template. My html file is pure html. Is there any way I can send that in a response conveniently without using the render_to_response?
I guess I can just read my html file into a string and send that via HttpResponse, I just thought there must be a better way
schinckel
harwiltz: So it's just a static file. Get your wsgi server to serve it.
Itkovian joined the channel
harwiltz
schinckel: Alright, I'll look into that. Thanks
FunkyBob
you said you were rendering it, with render_to_response....
rougeth
schinckel: the docs says "If you override the get_queryset() method and filter out any rows, Django will return incorrect results."
schinckel: incorrect because I'm filtering, right?
harwiltz
FunkyBob: Yeah, because I saw that online as an easy way to display html. But it's not a template
schinckel
It means you can't _ever_ get the rows that are filtered out.
FunkyBob
well, you're treating it as one
kreative joined the channel
rougeth
schinckel: uhmm, ok.. thank you! :)
harwiltz
FunkyBob: Yeah I know, and I want to change that
Diemuzi joined the channel
FunkyBob
then put it in static, ant server it there
what is it for , anyway?
FunkyBob waits for harwiltz to explain it's the launch page for their SPA
harwiltz
FunkyBob: Just as a learning excercise, lol. I'm quasi-comfortable with html/js/jquery, so I wanted to have a python backend and html/js/jquery frontend. Actually, more accurately, I want to have a frontend that is completely independent of django
Itkovian has quit
So that way I can use whatever I want for the frontend, and use python for the backend
pzp joined the channel
FunkyBob
so have your web server serve that static content... django always advises that
harwiltz
But interestingly enough, I did try putting my html under my static dir. I got the same error
FunkyBob
what error?
harwiltz
TemplateDoesNotExist
FunkyBob
if it's in static, .... django doesn't serve it
so
what were you doing that raised that error? treating it like a template
when, as you said, it's static
stop using django to serve it
harwiltz
Oh, I see. So how do I render it then? Just by typing in <ip>:8000/static/index.hmtl?
chl_ has quit
Yeah that works...
But what if I wanted to incorporate this with the url stuff in urls.py? So that why I can make use of the fancy regex with displaying this page?
FunkyBob
... why? it's static
rajalokan has quit
harwiltz
Yeah... I guess that would be useless
FunkyBob
I like you.
hamub joined the channel
harwiltz
Is that sarcastic?
I feel like I just made myself look like a donkey, haha
FunkyBob
no, it's honest. you think, you explore, you challenge, you reason... and you accept input
harwiltz
Well, I appreciate that! Thanks! And I like you too, you have been helpful. Sometimes the people on IRC have less patience than you ;)