|
Anyone have experience playing with Django and Google Apps? I'm in the design stages of an application for a domain that has business hosted Gmail. I'd love it if there's a way to authenticate users with Google Accounts but Google's single sign on documentation isn't exactly clear on this subject unless I'm explicitly using Google App Engine or something that appears to support Django 0.97.
|
# ¿ Apr 28, 2011 03:59 |
|
|
# ¿ Apr 29, 2024 13:24 |
|
I was never able to get the live streams working from the office. Any idea on how soon until the sessions are posted on Blip? It seems like it has taken a few weeks in the past.
|
# ¿ Sep 13, 2011 20:06 |
|
Do you guys have any rules of thumb between where you separate your view and template logic? I am building what should be a straightforward app for time reporting and display and I feel really confident about my models. For the views, I can get it to work but it feels clunky. For example, for a given reporting period (month) I'm pulling back all of the records and for unique charge codes in a week I'm building a table (list of lists), and displaying it out. Sounds straightforward enough, but getting things into stuff that's "easy" for the template to spit out (tabular data in lists) is a real pain to do additional things with later, such as refer to attributes that I could have in the code with a simple dictionary. For example, when I want to add row-wise hourly totals or label the charge codes with descriptions from my models, the template language has to be blown up and what I write feels really odd, which usually means I'm doing it wrong. In fact, I'm pretty sure I'm doing a poor job of it because I have considered just making weeks packaged responses in JSON and coding up javascript to control how to view the data.
|
# ¿ Mar 13, 2012 04:22 |
|
You need to install python flup. Once you can import that, set up lighttpd to talk fastcgi on a specific port (not your external web port), then run manage.py in fastcgi mode to talk to the same port. I think the Django docs on this should get you there.
|
# ¿ May 15, 2012 22:10 |
|
I'm working on a project for fun and I have a model in particular:Python code:
For viewing I have a view function that does a lot of the heavy lifting like steps 2-3 and packages this stuff into a custom data type that I have a custom templatetag pick up and parse. Now I find myself thinking about the editing part, where I'd like to have all of this be a form where you can edit the values for a month. I could do a formset of formsets thing for the month-week-codes, but this sounds like an awful lot of repeating myself. Should I load up the ChargeEntryManager with some custom functions to return packages of data in the format I need? I'm really having trouble wrapping my head around a container for all of these objects that I will eventually be slicing different ways... while not repeating myself and not making redundant queries to the db.
|
# ¿ Jun 5, 2012 04:52 |
|
A few months ago some big Python/Django person wrote a blog post about integrating AngularJS into their Django apps. Does anyone know what I'm talking about and have a link? I'm at a loss.
|
# ¿ Nov 19, 2013 04:07 |
|
Today I started getting a few "Invalid HTTP_HOST header:" that point back to my Amazon AWS external IP. Should I be concerned about this? Django is running through WSGI to nginx on a local tcp socket. From quick googling it looks like something not to worry about (just spoofers) but wanted to make sure and kind of understand what's going on here. Are people just forging headers with a from address of my public IP? Hed fucked around with this message at 01:16 on Jun 21, 2014 |
# ¿ Jun 21, 2014 01:09 |
|
I've done it on a few projects and one that my company depends on every day. You definitely aren't alone.
|
# ¿ Aug 10, 2014 21:54 |
|
I may be misunderstanding your question but is this what you want?code:
|
# ¿ Sep 13, 2014 00:59 |
|
Can you paste your whole server block? There could be other matchings going on. Can you set only the static location block on and put autoindex on and browse the directory? Nginx normally runs as nobody but the files need to be readable by a set user (default www-data) in order for the web server to see them. I didn't think an error there was a 404 though.
|
# ¿ Dec 4, 2014 22:47 |
|
I think one of the problems we're having with answering that question is it generally doesn't make sense to filter things in the serializer. Another way of thinking about that is that your UserProfile serializer should know how to serialize/deserialize UserProfile objects well, and nothing else. So in that sense your UserProfileSerializer looks fine if a little verbose. To restrict your GET to whatever, then the most straightforward way is to filter your view in the manner fletcher suggested: Python code:
|
# ¿ Dec 10, 2014 04:01 |
|
I had a problem a few weeks ago where I had an app either without templates or something with higher in the app order list and it seemed like the framework just stopped checking after that. I didn't mess with it enough to debug that issue because I had already wasted enough time on it. Anyway, you might try shuffling your app order and seeing if the problem returns.
|
# ¿ Dec 14, 2014 17:21 |
|
I'm going to wait for 3.1 after messing around with it a bit yesterday for some of the nested/related field goodness to work a bit more to my liking.supermikhail posted:But I'm not sure what exactly it wants from me. And whether I can do anything. If I understand it correctly, it receives a unicode string which it needs to convert to ascii, but there is no such character in ascii? Can you paste your view code or whatever actually generates the error? It looks like the error you're having is caused by a string encoded in UTF-8 being decoded through ASCII.
|
# ¿ Jan 4, 2015 19:08 |
|
ufarn posted:The people at work use Drupal for e-commerce client solutions, but as I hate Drupal, I was wondering what the best Django module - that isn't straight-up Shopify - would be? I really like Mezzanine/cartridge
|
# ¿ Jan 11, 2015 16:05 |
|
What packages do you guys use for instance-level security? I'm thinking of something like where I can set security bits on an object and have a QuerySet only return rows that a user can see, as well as ensure DetailViews don't work for forbidden objects.
|
# ¿ Jan 16, 2015 04:44 |
|
Cheers!
|
# ¿ Jan 16, 2015 20:45 |
|
xpander posted:The system I'm working on subclasses django-extensions' TimeStampedModel. I'm making some minor additions to a template that is using this model, including putting the "modified" field on the page for the user to see. However, it never seems to have a value when used in the template - it's always blank. I've been able to print the value to the console, but that field doesn't seem to be inside the context object. Does Django not automatically pass fields from abstract base classes to context objects or something? Using {{ model.other_field }} works fine for anything listed on the model, but {{ model.modified }} does not. I can't quite seem to figure out the disconnect here. Are you able to print it to the debug console from the view (e.g. context['model'] from a generic view's context) or just in the Django shell? What you're talking about should work just fine in the template. The only other thing I can think of is if you had somehow coerced your model into something that responds to key lookups with an empty string or None.
|
# ¿ Mar 20, 2015 22:24 |
|
I have a project where I'm ingesting a large amount of data, and for this project it makes sense to map each dataset into its own database. In order to automate the "awareness" of a new database a bit better, I was going to move the DATABASES setting in the production settings.py out to JSON, then when I label a new dataset, fill in the db alias, write out the json, then kick the supervisord to restart the WSGI processes. How bad of an idea is this?
|
# ¿ Apr 8, 2015 23:50 |
|
2nd Rate Poster posted:great suggestions for databases thanks! I'm picking this back up at work this week so I think I'll put in your suggestion. Making it at worst one db lookup (to figure out the DB routing) per request is actually a great bargain, and not having to kick over a production server and cross your fingers that it comes back up is even better.
|
# ¿ Apr 14, 2015 02:37 |
|
Use django-debug-toolbar with something approximating real data on your dev/test server
|
# ¿ Jun 4, 2015 00:47 |
|
Thermopyle posted:I haven't done much Django except a little maintenance since 1.6 was the newest version. Getting ready to dive into some new projects and was just wondering if anyone has been keeping up with the 2 Scoops of Django books and if they do a good job of covering the best practices that have changed since 1.6? I've always liked the books but it's been a couple years since I picked up a copy... Y'know I got the 1.8 book because why not but I really haven't referred to it all that much. I think the stuff I've used is mainly their thoughts on caching frameworks and the new Postgres-specific features. There is some good stuff on deploying to SaaS/IaaS places but I think you have that down.
|
# ¿ Sep 29, 2015 00:58 |
|
It's hard to tell if you've gone too far without knowing the reason for your optimizing. Really major sites that use Django, you can bet everything in settings has earned its place there. If it's just a fun obsession, then that's fine. But it's the equivalent of those people who remove Aero or whatever theme Windows ships with because "that stuff is slowing my computer down "
|
# ¿ Mar 25, 2016 21:16 |
|
Some of the defaults for middleware handle sessions, the redirection to have slashes at the end (which is always a style question when running DRF), and some caching stuff that the client can pay attention to. I do think CSRF protection won't work without the middleware there injecting into the response and processing the requests. I'd be interested if all of that works as expected still. Still, it's kind of fun to see what can work.
|
# ¿ Mar 26, 2016 02:06 |
|
For example db creds, API keys. If you had a storefront you might have a development and testing settings.py with test PayPal/Stripe keys and a db with no creds, but in production you will obviously have your real API keys and database creds. It's a lot easier to set in the environment or other state, and as mentioned keeps it out of source control.
|
# ¿ Oct 15, 2016 19:55 |
|
Is there an app that will plug in advanced search? I basically want this:
It would be straightforward enough to code in a mixin or whatever, but I'm surprised I haven't found anything searching so far.
|
# ¿ Feb 15, 2017 03:19 |
|
Yes I have bought every edition and like he says it's great reference for the corners of the framework you don't use every day.
|
# ¿ Aug 14, 2017 02:24 |
|
Maybe less a Django question but I'm usually interested in implementing it in a Django context. Is there a list of strategies for keeping change history in fields? I've had a couple toy projects where it would be useful to have snapshots in time, or history when portions were edited. I've played around with having archive flags and creating new objects to link together, but they all have drawbacks. If this is a more general SQL thing I'd be interested in reading up, but haven't hit upon the correct phrase / terms yet.
|
# ¿ Oct 4, 2017 01:04 |
|
It works super well, it just sucks at scaling.
|
# ¿ Oct 4, 2017 01:52 |
|
Thermopyle posted:Yes, it's dope and that poo poo is the future. This looks neat but I'm having trouble figuring out where the persistent store of data is in a stateless thing like this. Do you bring up Amazon RDS and then all your lambda workers query that? Do you have to start optimizing for instantiation time now that overhead of spinning up your request (e.g. loading modules) is non-negligible?
|
# ¿ Oct 27, 2017 10:58 |
|
I think you need to use one of the components underneath the wrapper to use it that way. I remember the docs being tricky with that. I can look tomorrow, but also try doing a dir() on that wrapper object to see what your options are.
|
# ¿ Feb 22, 2018 04:16 |
|
Should be able to set this: https://docs.djangoproject.com/en/2.0/ref/settings/#append-slash
|
# ¿ Mar 7, 2018 00:31 |
|
Django would work and is great, but if you don’t need a DB with modeled objects (the ORM) it would probably be easier to just use bottle or flask IF you don’t already have experience with Django. To the second part I really think web sites are easier to design and dork around with than any GUI toolkit these days.
|
# ¿ Jul 23, 2018 00:51 |
|
NtotheTC posted:Is there a go-to e-commerce library for django that you guys use? Theres any number of them on django packages and django-oscar appears to be winning but popularity does not always trump experience I really enjoyed cartridge when I was building those. I thought it was easy to implement, customize, and extend. Haven’t used it since 2015 but might be worth a look.
|
# ¿ Jan 5, 2019 06:40 |
|
Has anyone been deploying on AWS lambda? Seems cool but I’m a little unclear if best practice is still to mess with Cookiecutter templates then install Zappa or just go with the default
|
# ¿ Jul 3, 2019 04:42 |
|
What are people's opinions on using UUIDs everywhere as the primary key? I'm starting a new Django project and while the framework has made it easy for a long time, I've seen mixed ideas on the Internet: that using UUIDs is both terrible and fine. For now I'm giving models that are going to be on my REST interface (which is most of them) an additional field that is based on the ShortUUID from Django extensions. Still, carting both around and dorking around with Django-REST-Framework to use both PKs and UUIDs seems a little silly.
|
# ¿ Aug 10, 2019 17:26 |
|
Since pytest was brought up in the other thread, I wanted to see what I was missing here. I get that just writing assert statements is more elegant than self.assertBlah() all over, but it looks like if I do Django tests that require DB access, I have to put decorators everywhere, and it doesn’t look nice to me. Am I missing something? Nothing to do with pytest but looking at my testing more rigorously did give me the excuse to grok factoryboy and faker, though, so that has cleaned up my tests significantly. They are much easier to reason about now.
|
# ¿ Aug 28, 2019 03:59 |
|
I had it installed but was following the OG pytest docs. Now I'm off to the races, 100% natural testing with 20% less boilerplate. Thanks!
|
# ¿ Aug 29, 2019 14:54 |
|
I was going to build an app on to a project where users can design arbitrary questionnaires / polls. Since a dynamic schema can be a little tricky, has anyone used Entity-attribute-value package like django-eav2? I'm considering using that to store the data to tie back to a Django object. Alternatively I could just use JSON(B) fields. Given that I want to run calculations and eventually report on these I'm trying to see if anyone has anything that worked well for them in the past.
|
# ¿ Oct 3, 2019 03:32 |
|
Thanks guys, after thinking a bit more about it you’re both right. I was getting hung up on how people could dynamically assign questions to questionnaires and went looking for complicated solutions instead of back to fundamentals.
|
# ¿ Oct 8, 2019 02:12 |
|
|
# ¿ Apr 29, 2024 13:24 |
|
What's a good basic blog app to use on a project in 2020? I see from django-packages mezzanine is still around but feels kind of heavyweight. I really just need basic formatting with image insertion, posts, tags, and permalinks.
|
# ¿ Feb 20, 2020 22:35 |