|
Stabby McDamage posted:Is there an easy way to do user authentication against users on the server itself? ...within a certain group? This is what I use in production. I pass authentication UP the chain to Apache and rely on Apache LDAP to do HTTP Digest authentication against whatever LDAP group you want to go against. Apache will simply just pass back an "authorized user" to Django and the app will just log that user in automatically. Here's a sample from my Django settings.py code:
code:
|
# ¿ Nov 7, 2009 00:17 |
|
|
# ¿ May 15, 2024 15:40 |
|
king_kilr posted:That's because that code won't work lower('profile__name') tries to use Django's ORM syntax in pure SQL. Hmm.... Might be a good suggestion for Django to throw a exception Warning for using an ORM Syntax that isn't 100% compliant against all backends.
|
# ¿ Nov 8, 2009 08:39 |
|
I'm trying to use Django's built in serializer object since I've just been directly calling simplejson forever but, I'm running into some quirks. I'm going to have a lot of views returning API information and am trying to follow from DRY concepts so I am writing a wrapper to handle the serialization and returning a proper HttpResponse. My problem is that I'm not always returning Django objects. Sometimes I'm just returning normal Python objects. The serializer will choke when it doesn't see Django's _meta tag. Is there a work around here? I'd like to use the Django serialization function since I'd like to support all the formats it supports (json, xml, yaml) ---- I'm feeling a little worn out right now so I'm probably explaining this horridly... So hopefully the code will speak for itself. Here is my current 'helper' module and an example implementation code:
code:
ATLbeer fucked around with this message at 20:21 on Nov 19, 2009 |
# ¿ Nov 19, 2009 19:50 |
|
Just an FYI of something that I bumped into. Not specifically Django related but, you can run into it. When a unicode character is passed into an ORM statement example ("& #9829;" = ♥ but, vBul alters it below) code:
Of course this only happens if your DB tables are not UTF-8 but, it looks like the default for MySQL might be latin1 so, unless you changed it before, you probably are running latin1. The way we are catching it currently is by casting the user input into a string and catching the UnicodeEncodeError and handling that error instead of the OperationalError. Just another FYI, never trust any user input, ever.
|
# ¿ Feb 2, 2010 21:44 |
|
bitprophet posted:if you're lucky, you can introspect the exception's string value or other elements (depends on who wrote the exception and what they do with it) and derive additional meaning from that. Though I still find it nasty to have to hard-code that sort of comparison. I tried that as a patch but, drat was it ugly. I also didn't like to be dependent upon the fact that the exception might not change but, there's never a guarantee that the text of the error in the exception might change in MySQLdb (which I was never a big fan of, I'm falling into the dislike category now) It's less hacky than inspecting the exception information but, I think the solution of forcing the exception before possible reaching the OperationalError stage is a slightly better solution. Has anyone used anything like ( https://launchpad.net/myconnpy )? A pure Python MySQL connector would be much nicer than the current MySQLdb connector.
|
# ¿ Feb 2, 2010 22:58 |
|
So.. The OP is WAY out of date by now and I was going to restart the thread with a brand new OP but, thought about all going web 2.0 twitter feedy with it.. I figured I should transfer the OP to a blog and completely rewrote it for Django >1.0 Here's what I have now: http://degizmo.com/series-django-tutorials/ Suggestions? Comments? Criticisms? Needs more Ponies?
|
# ¿ Mar 22, 2010 18:35 |
|
Mulozon Empuri posted:Tests? And perhaps something about fancy stuff like virtualenv? Virtualenv is probably out of scope in a basic tutorial but, tests... drat right, adding it to my to-do list
|
# ¿ Mar 22, 2010 23:41 |
|
king_kilr posted:There's a better source than adrian: http://twitter.com/TheOnion/status/10921296161 If anyone has any questions about it I can probably answer them, I interned there last summer I'd be curious on URL migration. Did they decide to just maintain their old URL structure from Drupal?
|
# ¿ Mar 23, 2010 19:37 |
|
Yay posted:One would hope so; anything else would be barbarous (yes, even redirects). So sign me up as curious, too. I probably should have expanded by asking if they were planning on staying with the same URL pattern in perpetuity for a while, are they just supporting old URLs in place with no desire to change, migrating the old URLs to the the new URLs with 302 redirects, etc?
|
# ¿ Mar 23, 2010 20:01 |
|
Random post on the internet speaking from the Onion Tech team's point of view. Looks legit but, no way to really verify I guess king_kllr? Any opinion on the validity of their statements? http://www.reddit.com/r/django/comments/bhvhz/the_onion_uses_django_and_why_it_matters_to_us/
|
# ¿ Mar 25, 2010 12:28 |
|
Lamacq posted:How often does the list of countries and states change? Tangentially realated: Google Maps have had a few problems, specifically with India : Kashmir, and China : Taiwan. They resolved it by showing different maps, with different boundaries and names in different geo-ip located regions.
|
# ¿ Mar 25, 2010 19:19 |
|
From the reddit onion threadquote:And the biggest performance boost of all: caching 404s and sending Cache-Control headers to the CDN on 404. Upwards of 66% of our server time is spent on serving 404s from spiders crawling invalid urls and from urls that exist out in the wild from 6-10 years ago. [Edit: We dropped our outgoing bandwidth by about 66% and our load average on our web server cluster by about 50% after implementing that change] wow...
|
# ¿ Mar 25, 2010 19:30 |
|
Doh004 posted:May I ask what environments you guys develop Django applications on? Right now, I have a WAMP installation on my desktop with mod_wsgi. It also does that thing where it reloads apache each time a page loads so I don't have to manually restart apache each time I make a change to the python. Use the built in development server "python manage.py runserver" Dev: OS X, sqlite, redis / ubuntu, sqlite, redis Prod: REHL, apache mod_wsgi, MySQL, redis All virtualenv, pip
|
# ¿ Apr 8, 2010 23:37 |
|
LuckySevens posted:How can I set that up on a timer? http://www.djangosnippets.org/snippets/374/ + cron
|
# ¿ Apr 27, 2010 19:38 |
|
LuckySevens posted:Anyone know a good way to stream a movie of your desktop via a django page? This isn't related to Django at all... BUT, http://github.com/kanaka/noVNC
|
# ¿ Jul 13, 2010 19:14 |
|
Ferg posted:So question about unit testing in Django (and maybe this is Python in general). I'm writing up unit tests for a module which manages a user's friend list. This involves functions to add friends, remove friends, get a list of the users friends, etc. Am I correct in my understanding that each unit test runs exclusively, so if I'm wanting to test retrieving a user's friends that I should also add friends in that same test? Might want to look at nose if you want some full automated unit testing http://code.google.com/p/python-nose/ http://code.google.com/p/nose-django/
|
# ¿ Jul 19, 2010 19:19 |
|
For models, the only thing I test are additional methods or manager that are added. No reason to test the basics of the models themselves
|
# ¿ Aug 13, 2010 23:41 |
|
|
# ¿ May 15, 2024 15:40 |
|
MonkeyMaker posted:Has anyone implemented their own AdminSite? How easy/hard was the basic implementation? Two questions 1) Have you looked into some of the existing django CMS options (including Ellington?) 2) Why reinvent the wheel. Just build, chop and modify the existing admin site to your needs. I can't imagine something you wouldn't be able to do within the existing admin system.
|
# ¿ Nov 25, 2010 02:22 |