|
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 |
|
|
# ? Jun 1, 2024 06:20 |
|
Good to hear it! Speaking of DRF, apparently Tom Christie started a Kickstarter in the middle of July to fund development of v3 and I didn't even know about it until this afternoon. Anyway, he blew past his goal of £4,000 and reached all the way to £31,043 as of today. Here's hoping it results in some nice new features in a short-ish timeframe.
|
# ? Aug 10, 2014 22:28 |
|
Thermopyle posted:I'm thinking about totally forgoing Django's views and forms and doing everything with django-rest-framework. Anyone else doing this? Stupid idea? Brilliant idea? So how would you validate client input? Is this something django-rest-framework does against the model when it handles requests?
|
# ? Aug 10, 2014 23:15 |
|
I have a coworker who pronounces Django as "duh-jango" and it's getting pretty aggravating. No matter how many times I, or other coworkers, will say it to him or around him and pronounce it the correct way, he still pronounces the "D". Somewhat ironically, he also happens to be our team's only Django programmer, though he is a novice one. He does this with a few other words as well; pronouncing them completely phonetically despite being American and a native English speaker, and despite hearing them the correct way multiple times.
|
# ? Aug 10, 2014 23:24 |
|
Lumpy posted:So how would you validate client input? Is this something django-rest-framework does against the model when it handles requests? Yes. http://www.django-rest-framework.org/api-guide/serializers.html#validation
|
# ? Aug 10, 2014 23:27 |
|
Zarithas posted:I have a coworker who pronounces Django as "duh-jango" and it's getting pretty aggravating. No matter how many times I, or other coworkers, will say it to him or around him and pronounce it the correct way, he still pronounces the "D". Beat him up imo.
|
# ? Aug 10, 2014 23:37 |
|
Thermopyle posted:I'm thinking about totally forgoing Django's views and forms and doing everything with django-rest-framework. Anyone else doing this? Stupid idea? Brilliant idea? Django rest framework is slow as a dog. Consider something like tastypie instead. edit: We're handling giant government datasets at work and stuffing them into EMBs and all sorts of horrible nonsense though so maybe its poor performance on huge datasets might not be so accute to your needs. duck monster fucked around with this message at 18:24 on Aug 12, 2014 |
# ? Aug 12, 2014 18:18 |
|
Thermopyle posted:I'm thinking about totally forgoing Django's views and forms and doing everything with django-rest-framework. Anyone else doing this? Stupid idea? Brilliant idea? Add one more vote for this method. My latest project is angular/dart on the frontend and django/rest on the backend. I've been very happy with it. I'd recommend it anytime you're doing a complicated client side heavy app.
|
# ? Aug 12, 2014 18:25 |
|
duck monster posted:Django rest framework is slow as a dog. Consider something like tastypie instead. Can you give some more specifics about this performance problem? Where is the slowness, in the serialization? The views are very simple. I found tastypie's API to be extremely hostile to developers, so I typically go with DRF.
|
# ? Aug 12, 2014 18:29 |
|
Any good up to date guides on deploying / hardening a Linux Django install? I would like to deploy to a VPS like Digital Ocean, but I definitely don't want to miss anything security-wise if I go that way.
|
# ? Aug 15, 2014 08:44 |
|
Here's a tip I just spent two hours figuring out. When you create model instances in setupClass in django.test.TestCase, those instances never get flushed. You can have unit tests in other files in other apps that are screwed up because those instances still exist until the end of the test runner. You have to manually flush them in tearDownClass.
|
# ? Aug 17, 2014 17:56 |
|
Thermopyle posted:When you create model instances in setupClass in django.test.TestCase, those instances never get flushed. This is a really common gotcha in Rails too. The transactions wrap individual testcases, not the suite. Most reasonable db backends support some kind of nested transactions, though, so that seems like something that could be fixed...
|
# ? Aug 17, 2014 18:40 |
I'm working on a django app that uses pandas and embedded bokeh plots for portfolio analysis with time series data. I'm looking to move the app to a shared hosting service like webfaction or dreamhost to demo to my bosses and argue my time should be spent on this versus things that actually generate revenue for the company. My background is in engineering/stats and I have zero experience with the basics of moving an app into production on a non-localhost. What's the process for running the bokeh-server (or any shell process) on a shared host? During local development I'm able to just run the server using command prompt and let it sit idle. Would webfaction's shell access(http://docs.webfaction.com/user-guide/access.html) allow for this? This is probably a super naive question so I'm having a hard time finding relevant examples on searching google. Or for those familiar with Bokeh, is the bokeh-server not meant to be used in this way and I should into something else? KingNastidon fucked around with this message at 04:46 on Aug 18, 2014 |
|
# ? Aug 18, 2014 04:39 |
|
KingNastidon posted:I'm working on a django app that uses pandas and embedded bokeh plots for portfolio analysis with time series data. I'm looking to move the app to a shared hosting service like webfaction or dreamhost to demo to my bosses and argue my time should be spent on this versus things that actually generate revenue for the company. You'll probably find deployment a lot easier with something like Heroku.
|
# ? Aug 18, 2014 05:15 |
|
I've been pretty fond of Docker lately. It seems pretty easy to get up a working docker container and then just poo poo that thing into the 'cloud'. And by 'cloud' I mean any number of services including you own "apt-get install dockerio" setup
|
# ? Aug 18, 2014 19:32 |
|
If you know someone decent at Django, have them set up the Heroku Deploy Button for you.
|
# ? Aug 18, 2014 20:20 |
|
How do you compose the equivalent of "where butts in ( select farts from .. )", when I already have a queryset for the inner select from another function?
|
# ? Aug 20, 2014 15:42 |
|
Pretty sure that would be: Crap.objects.filter(butts__in=farts_queryset) So long as there is a key link between butts and farts.
|
# ? Aug 20, 2014 17:24 |
|
Ahz posted:Pretty sure that would be: That was it, thanks.
|
# ? Aug 20, 2014 22:22 |
|
Just finished my first project using Django CMS 3. Outside of some questionable front-end decisions I really like it, the inline editing is a huge bonus for my clients. Between this and Wagtail, feels good not to have to hack at the django admin panel for simple projects.
|
# ? Aug 25, 2014 19:40 |
|
I'm looking at Django REST Framework and I think it's pretty good I guess. What do you guys think? Are there other ways of using Django to create a REST api? Would you recommend against trying to "roll my own"?
|
# ? Aug 27, 2014 07:16 |
Storgar posted:I'm looking at Django REST Framework and I think it's pretty good I guess. What do you guys think? DRF is awesome, I highly recommend it. Don't roll your own, others have already put a ton of time/effort into figuring things out for us already.
|
|
# ? Aug 27, 2014 08:45 |
|
fletcher posted:DRF is awesome, I highly recommend it. Don't roll your own, others have already put a ton of time/effort into figuring things out for us already. I will second this. I implemented an API in tastypie and then redid it in DRF just for the sake of seeing the difference and I found DRF to be much more workable.
|
# ? Aug 27, 2014 14:02 |
|
The March Hare posted:I will second this. I implemented an API in tastypie and then redid it in DRF just for the sake of seeing the difference and I found DRF to be much more workable. I'll third this? Just adding that I converted both a piston and a tastypie implementation over. DRF is the way to go.
|
# ? Aug 27, 2014 14:56 |
|
Wow, sweet. The tutorial and documentation is awesome too. DRF it is!
|
# ? Aug 27, 2014 18:55 |
|
I sometimes find myself wishing for Classy Class Based Views, but for DRF.
|
# ? Aug 27, 2014 19:36 |
|
Anyone know how to integrate bokeh into Django? I know bokeh can do output to static pages, but is there a way to mix its output into a TemplateView's output?
|
# ? Sep 2, 2014 13:35 |
|
ORM and Sequence question: I have what is essentially a table which is a pool of available codes/sequences for unique keys when I create records elsewhere in the DB. Right now I run a transaction where I might grab 5000 codes out of an available pool of 1 billion codes using the slice operator [:code_count] where code_count == 5000. This works fine, but then for every insert, I have to run through each code and insert it into the record manually when I use the code. Is there a better way? Example code (omitting other attributes for each new_item that are similar to all new_items): Python code:
Ahz fucked around with this message at 17:41 on Sep 4, 2014 |
# ? Sep 4, 2014 17:37 |
|
Nevermind, it works great withcode:
|
# ? Sep 4, 2014 21:45 |
|
I'm getting duplicates in queries involving many-to-one relationships. One airfield can have many runways. The query below is returning the Airfield object for each runway that meets the length criteria. Ie if I have an Airfield that has three Runways greater than min_rwy_len, the airfield is in the result 3 times. Python code:
edit: running distinct() at the end of the query fixes this. Dominoes fucked around with this message at 06:33 on Sep 8, 2014 |
# ? Sep 8, 2014 06:04 |
|
Any recommendations on a json-rpc package? Thanks for the Django Rest Framework info and recommendation about the docs, by the way. e. Also I plan to combine it with DRF, so if there's anything I should know that'd be awesome. Thanks! ee. Hmmm, upon giving it some more thought it looks like DRF should almost cover the server-side of the whole ajax through JSON-RPC schtick. Which just leaves me wondering how I can use javascript to make calls to the api... Storgar fucked around with this message at 09:12 on Sep 9, 2014 |
# ? Sep 9, 2014 08:54 |
|
You could use something like Backbone.js or plain jquery, there's probably a shitload but we use those two at work and they don't make me want to stab my eyes out as much as some of the other code we have.
|
# ? Sep 9, 2014 13:27 |
|
I have a basic form view. It's redirecting to the top-level url, (For the test server, http://127.0.0.1:8000/) and therefor returning a Page Not Found error instead of staying on the same url and displaying the result, as it should.Python code:
|
# ? Sep 9, 2014 23:11 |
|
Dominoes posted:I have a basic form view. It's redirecting to the top-level url, (For the test server, http://127.0.0.1:8000/) and therefor returning a Page Not Found error instead of staying on the same url and displaying the result, as it should. Post your form html client output. Your action field is probably misdirected.
|
# ? Sep 9, 2014 23:20 |
|
Thanks - good call. The problem was in the action field of my HTML template.
Dominoes fucked around with this message at 23:37 on Sep 9, 2014 |
# ? Sep 9, 2014 23:23 |
|
Ephphatha posted:You could use something like Backbone.js or plain jquery, there's probably a shitload but we use those two at work and they don't make me want to stab my eyes out as much as some of the other code we have. Angular.js is great for solving all sorts of problems you don't have. Been forced to use it at work, and its very powerful and all, but I can't help wondering why I'm writing huge steaming piles of boilerplate when 3 lines of jQuery will do. loving government jobs.
|
# ? Sep 10, 2014 16:12 |
How do you write tests for a form wizard? I need to test the done() function after all the forms are submitted. I'm having trouble finding relevant info on google.
|
|
# ? Sep 10, 2014 23:55 |
|
I'm trying to generate code coverage for my apps and for some reason django_nose and coverage aren't generating reports for my view tests. My setup.cfg (for nose) looks like this: INI code:
INI code:
Python code:
Am I missing something? The documentation for django_nose and how it interacts with coverage isn't great. Also, three other related items:
|
# ? Sep 11, 2014 00:20 |
|
Blinkz0rz posted:Also, three other related items: I model_mommy instead of factory_boy, but you do something like: Python code:
You want to be testing small units of code. So if you have a method that that calls code from somewhere else in your project, mock the return value of that other code. I mean, you don't have to get crazy with it, but python's mock makes mocking pretty easy. You can test that your code calls the remote code by using the Mock.assert_*() methods.
|
# ? Sep 11, 2014 01:37 |
|
|
# ? Jun 1, 2024 06:20 |
|
Is there a way to query for anything, like a wildcard? Improvised method below, looking for something more explicit.Python code:
Dominoes fucked around with this message at 13:25 on Sep 12, 2014 |
# ? Sep 12, 2014 13:23 |