|
mwarkentin posted:I've been using Heroku. Very cool service. See, my thing with heroku is that I have to host several sites (about 12 django sites in all) and it seems heroku is geared more towards hosting larger, singular apps. I'm sure that isn't the case, but it's super tough finding decent documentation on how to manage multiple sites on one instance.
|
# ? Mar 7, 2012 08:18 |
|
|
# ? May 16, 2024 05:40 |
|
Hanpan posted:See, my thing with heroku is that I have to host several sites (about 12 django sites in all) and it seems heroku is geared more towards hosting larger, singular apps. I'm sure that isn't the case, but it's super tough finding decent documentation on how to manage multiple sites on one instance. I'm not really sure what you're asking. Is this 12 sites with the same code or 12 separate apps? You can totally have 12 apps no problem. I have 65 right now If it's 12 sites with the same code, check out heroku domains:add. Also the support guys are really great and can answer a lot of questions, but I'm happy to help here as well. And if anyone wants into our beta program drop me a PM.
|
# ? Mar 7, 2012 09:03 |
|
I use Gondor for all my sites and have been extremely happy with them.
|
# ? Mar 7, 2012 12:52 |
|
Yeah, you can create as many Heroku instances as you want.. and for each one, the first process is free..
|
# ? Mar 7, 2012 14:02 |
|
I'm having some trouble with the Django test client, almost certainly down to a lack of understanding on my part somewhere. My google fu hasn't been strong enough to help, so hopefully one of you guys can point me in the right direction. I've built a REST interface to a Django app and am now writing tests for it. I've hit a wall trying to get JSON data into my view code. The first thing I tried was to pass the data into the test client already json encoded. code:
code:
code:
code:
Does anyone have any advice for how to solve this? Thanks!
|
# ? Mar 7, 2012 14:31 |
|
Do you need to set content-type to application/json? See the third arg here: https://docs.djangoproject.com/en/1.3/topics/testing/#django.test.client.Client.post
|
# ? Mar 7, 2012 14:43 |
|
Added content_type="application/json" and still getting the same error messages, with and without the simplejson.dumps.
|
# ? Mar 7, 2012 15:06 |
|
So I've been spending some time investigating each of the Django compatible PaaS that have been recommended in this thread. It's crazy how many there are now, I'm so glad to see Django finally getting the attention it deserves. After tinkering around, I decided that DotCloud works the best for me, although it was a close call between that and Gondor. Thanks to everyone in this thread who made some suggestions. In the interests of 'giving back', I was going to write up a step by step deployment guide using DotCloud and CloudFront for static files. If anyone thinks they can gleam anything from it, feel free to drop me a PM and I'll share.
|
# ? Mar 8, 2012 23:56 |
|
DotCloud's support also owns bones. The even have a StackExchange-like knowledge base. (Although I don't know if it's any good.) The main argument against DotCloud is that Windows is basically unsupported, which seems ridiculous. ufarn fucked around with this message at 00:15 on Mar 9, 2012 |
# ? Mar 9, 2012 00:12 |
|
Lister_of_smeg posted:So now my view code is being called, but the JSON decode is barfing because there are no JSON objects in the data. It looks like Client put/post methods will URL encode your data dictionary no matter what content type you use. The request.raw_post_data you are getting in your view will be something like "resource_id=123&site_id=1" which isn't a JSON string. You might be able to use this (entirely untested) Client class to make your test work: code:
|
# ? Mar 9, 2012 08:05 |
|
Okay Django thread, time for me to ask a question without being dumb and gay (hopefully): I just started using django-registration, and while it's pretty great, I can't seem to figure out why anything having to do with password management renders using the Django admin templates. For instance, on the password reset form (registration/password_reset_form.html), it claims to extend my base.html and yada yada, yet... it doesn't. In fact, no changes I make to the template seem to apply. Seeing as django-registration doesn't come with any default templates, I have no idea where the hell it's rendering these forms from. All of the other templates (log in/out, registration form, etc) seem to render fine. Uhm, why?
|
# ? Mar 12, 2012 05:56 |
|
root beer posted:Okay Django thread, time for me to ask a question without being dumb and gay (hopefully):
|
# ? Mar 12, 2012 13:16 |
|
This is only semi-related to Django, but I'm trying to move an app from SQLite to PostgreSQL, and I can't get Django to connect to the local database. I've created a database and user like so:code:
code:
code:
|
# ? Mar 12, 2012 20:03 |
|
ninepints posted:This is only semi-related to Django, but I'm trying to move an app from SQLite to PostgreSQL, and I can't get Django to connect to the local database. I've created a database and user like so: It may not be the solution to your error in question, but it's nevertheless something you need to do. I believe this is the guide I originally used to wrap my head around postgreSQL on Ubuntu with Django. ufarn fucked around with this message at 20:19 on Mar 12, 2012 |
# ? Mar 12, 2012 20:16 |
|
This is really strange. Would there be any reason why just the admin account's password is reset every time I run syncdb (no changes have occurred) and restart apache? Doesn't happen for other user accounts. Edit: Heh, whoops. I had initial_data.json sitting in my project root, which contained said admin user. epswing fucked around with this message at 22:03 on Mar 12, 2012 |
# ? Mar 12, 2012 21:47 |
|
ufarn posted:You need to define HOST as 'localhost' with postgreSQL for it to work. It confounded me as well the first time. That did the trick! Thanks. There's a very misleading comment on that line...
|
# ? Mar 12, 2012 22:12 |
|
ninepints posted:That did the trick! Thanks. There's a very misleading comment on that line... And what's the misleading part, just so I can clarify myself, if I see someone with the same problem another time?
|
# ? Mar 12, 2012 23:14 |
|
ufarn posted:Was it 'localhost' or the guide that did it? code:
|
# ? Mar 13, 2012 00:08 |
|
MEAT TREAT posted:
|
# ? Mar 13, 2012 00:18 |
|
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 |
|
Hed posted: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. I run into this sort of situation too, where I feel like I'm putting too much display logic in my view function to get around the limitations of the template language. I believe the answer is simply that you need to move that code into a custom template tag.
|
# ? Mar 13, 2012 20:10 |
|
My basic rule of thumb is, I think, different to most people's (at least in the code I see, both at work and in the community at large), in that the view is pretty dumb. Its sole purpose is to get Some Data to display - that is, render a template (usually) into a response object. So if there's logic required to display that template (say, if it requires an authenticated user, or the view could receive an ajax request and load a different template), that goes in the view. Obvious things like required filtering of querysets, or raising a different status code (404, 401, etc) also go in the view. Everything else goes into the context, and leaves the template to make decisions about what to do with it. Mostly, it keeps views and templates easy to read months later, at the expense things being in multiple files. Mind, if I'm not using classy-tags, then everything in the world is in the view, but that's usually legacy stuff.
|
# ? Mar 13, 2012 20:29 |
|
ufarn posted:Download django-registration-defaults and use that as your default templates, until you modify them. Much, much easier than the pain in the rear end of figuring out django-registration. That's what I did. They're being overridden somehow. vvv Nope. DICTATOR OF FUNK fucked around with this message at 02:06 on Mar 14, 2012 |
# ? Mar 14, 2012 00:18 |
|
root beer posted:That's what I did.
|
# ? Mar 14, 2012 00:36 |
|
So I'm having some trouble with collectstatic, here is my settings file:code:
code:
|
# ? Mar 22, 2012 00:21 |
|
Hanpan posted:So I'm having some trouble with collectstatic, here is my settings file: It seems like the `ignore` option only globs against the filename and doesn't include the path. I'm not sure if that's a bug or intentional, and I'm not sure offhand of a way to do what you want to do.
|
# ? Mar 22, 2012 04:15 |
|
avidal posted:It seems like the `ignore` option only globs against the filename and doesn't include the path. I'm not sure if that's a bug or intentional, and I'm not sure offhand of a way to do what you want to do. Ahh rubbish, I hope they re-think that. It's a bit of pain having to push all the admin files with each collection, not to mention it's taking a huge chunk out of my S3 push allowance.
|
# ? Mar 22, 2012 09:10 |
|
avidal posted:It seems like the `ignore` option only globs against the filename and doesn't include the path. I'm not sure if that's a bug or intentional, and I'm not sure offhand of a way to do what you want to do. Am I missing something, or should this not work for dirs as well? [edit] oh I guess I was. django docs posted:--ignore <pattern> Mulozon Empuri fucked around with this message at 10:16 on Mar 22, 2012 |
# ? Mar 22, 2012 10:02 |
|
I am running into this error:quote:OperationalError at (...) I happens when I want to save this plain text as an entry: code:
code:
I have found out that the error is caused by Bleach, a wrapper that sanitizes a string. It comes with this caveat: quote:Bleach always returns a unicode object, whether you give it a bytestring or a unicode object, but Bleach does not attempt to detect incoming character encodings, and will assume UTF-8. The - relevant part of the - view that parses the POST request is this: code:
code:
|
# ? Mar 22, 2012 15:36 |
|
It works fine for me using 1.4rc2. I'm wondering if maybe there was a fix somewhere in there. ./manage.py collectstatic -i 'admin' doesn't collect the admin files for me.
|
# ? Mar 22, 2012 15:44 |
|
ufarn posted:Unicode nightmare code:
code:
|
# ? Mar 23, 2012 15:24 |
|
1.4 was officially released today, whoo
|
# ? Mar 23, 2012 23:57 |
|
Finally got back to working on my main project, and am getting started with class based views and mixins and stuff. Holy poo poo did I not know what I was missing. It's just so nice to work with class views.
|
# ? Mar 30, 2012 11:30 |
|
Maluco Marinero posted:Finally got back to working on my main project, and am getting started with class based views and mixins and stuff. Holy poo poo did I not know what I was missing. It's just so nice to work with class views. Yes, yes it is.
|
# ? Mar 30, 2012 18:50 |
|
I really don't understand the advantage of mixins. Is there a simple reason as to why they are so much better?
|
# ? Mar 30, 2012 20:00 |
|
It just feels a tonne nicer to me, and you can do a lot more without things feeling like code soup. There's a point where procedural just gets too unwieldly with a relatively complicated view, even if you're diligently extracting functions from the main function. Being able to save common stuff to self is a very nice option to have in the view logic.
|
# ? Mar 30, 2012 22:56 |
|
Hanpan posted:I really don't understand the advantage of mixins. Is there a simple reason as to why they are so much better? They stop you from repeating yourself so much. It's not really a big deal if you're building some blog site or something, but when you get into a giant system (like I'm currently building), saving time implementing the same logic over and over again is a giant time- and sanity-saver.
|
# ? Mar 31, 2012 01:49 |
|
MonkeyMaker posted:They stop you from repeating yourself so much. It's not really a big deal if you're building some blog site or something, but when you get into a giant system (like I'm currently building), saving time implementing the same logic over and over again is a giant time- and sanity-saver. Couldn't you already do that with decorators?
|
# ? Mar 31, 2012 02:02 |
|
Decorators are more helpful for changing the entire function arguments or results, or for changing when a function runs. Mixins are useful for encapsulating functionality that will be used in more than one place. Here's a simplified example... code:
To continue with this example... Let's say a user notices the bug in get_user_profile where we return a queryset of profiles instead of an individual user profile. Instead of having to make change to methods across all our classes that get a user profiles, we can just change the method definition on the ProfileMixin. That's the usefulness of a Mixin. 2nd Rate Poster fucked around with this message at 03:14 on Mar 31, 2012 |
# ? Mar 31, 2012 03:04 |
|
|
# ? May 16, 2024 05:40 |
|
Why not a function? You aren't using self anywhere in your mixin, so I don't see why you have it as a mixin...code:
|
# ? Mar 31, 2012 05:15 |