|
Okay, I'm actually having some trouble now. I first tried Zinnia, but I ran into an issue where one of the modules it expected Django to have didn't exist (), so I tried to update Django. (I'm running in a venv now, so no worries) pip told me to upgrade it but then Django bitched about there already being an install, and told me to delete the sitepackages/django directory. I did that then tried to reinstall, but I can't because pip and easy_install say it's already installed. I might just wipe Django from my main installation and work from virtualenv from now on. edit: Amazing. Mezzanine fucks up my installation too because it hasn't updated to 1.6. Pollyanna fucked around with this message at 17:36 on Nov 8, 2013 |
# ? Nov 8, 2013 17:21 |
|
|
# ? May 16, 2024 19:03 |
|
Maluco Marinero posted:You don't need a model, you just need to actually load the form in the view, at the moment you aren't doing that. Have a read, haven't done everything inside form.is_valid, but this should be a start for you. It should now render in the template.
|
# ? Nov 8, 2013 20:16 |
Pollyanna posted:Okay, I'm actually having some trouble now. I first tried Zinnia, but I ran into an issue where one of the modules it expected Django to have didn't exist (), so I tried to update Django. (I'm running in a venv now, so no worries) pip told me to upgrade it but then Django bitched about there already being an install, and told me to delete the sitepackages/django directory. I did that then tried to reinstall, but I can't because pip and easy_install say it's already installed. 1.6 is hot off the presses, you may want to stick with 1.5.5 for now until the libraries have a chance to catch up. I've never had to manually delete anything from sitepackaegs, not sure what happened there. What module was it complaining about Django missing? Copy/pasta the exact errors in here, somebody will be able to help you out. It sounds like maybe Django is installed outside of your virtualenv? Run deactivate to get out of your venv, then you should be able to do pip uninstall django to get rid of it. Otherwise you can tell venv to ignore those packages when you create your venv by using --no-site-packages. You don't even have to install Django in your venv before installing mezzanine, since mezzanine lists all the dependencies it needs, pip will automatically install the right versions of them: code:
|
|
# ? Nov 8, 2013 20:28 |
|
Dominoes posted:Thanks, this worked. Additionally, I needed to change the form's inheritance from form.ModelForm to form.Form. Ah yep, didnt see that. ModelForm is only for when you want a form to automatically generate from a database model defined in models.py.
|
# ? Nov 8, 2013 22:46 |
|
Has anyone gotten Django working on OpenShift? The tutorials I find lead to HTTP 403 errors. For example, if I follow this tutorial, the rhc tail dump is as follows: code:
The resulting tail dump: code:
New tail dump: code:
code:
edit a Dominoes fucked around with this message at 21:49 on Nov 12, 2013 |
# ? Nov 12, 2013 20:20 |
|
I want to create tens of thousands of model instances as fast as possible. Actually in not completely impossible cases it could be millions. This would be from what I guess you could call out of band scripts that import the models and create instances and save them. Anyone have any experience doing this? My first inclination is to use green threads, but I'm not sure how Django deals with concurrent writes. I'd also like to figure out a way to get Django to use a pool of database connections instead of creating a new connection for each model creation which I think is what it does now.
|
# ? Nov 13, 2013 00:05 |
|
Just write raw SQL for the importing at this point. The ORM is holding you back.
|
# ? Nov 13, 2013 00:32 |
|
Thermopyle posted:I'd also like to figure out a way to get Django to use a pool of database connections instead of creating a new connection for each model creation which I think is what it does now. I'd also suggest raw SQL like Suspicious Dish suggested. And use something like PGPool or PGBouncer as a connection pool for Django. Django 1.6 provides persistent connections per process, so that'll help too.
|
# ? Nov 13, 2013 00:54 |
|
Dominoes posted:Has anyone gotten Django working on OpenShift? The tutorials I find lead to HTTP 403 errors. Have you looked at https://github.com/openshift/django-example ?
|
# ? Nov 13, 2013 04:15 |
|
Raw SQL it is. Thanks dude(ttes)
|
# ? Nov 13, 2013 06:11 |
|
Suspicious Dish posted:Have you looked at https://github.com/openshift/django-example ? Dominoes fucked around with this message at 14:59 on Nov 13, 2013 |
# ? Nov 13, 2013 13:37 |
|
Try #openshift on Freenode?
|
# ? Nov 13, 2013 14:42 |
|
Thermopyle posted:I want to create tens of thousands of model instances as fast as possible. Actually in not completely impossible cases it could be millions. You could also use Model.objects.bulk_create and pass it a list of unsaved model instances. Build them up to some specified size (based on benchmarking) and then run the bulk_create call. Django will turn it into a single INSERT statement with multiple VALUES clauses.
|
# ? Nov 15, 2013 23:55 |
|
avidal posted:You could also use Model.objects.bulk_create and pass it a list of unsaved model instances. Build them up to some specified size (based on benchmarking) and then run the bulk_create call. Django will turn it into a single INSERT statement with multiple VALUES clauses. The "unsaved model instances" are all stored in memory, though. Not sure you'd want potentially millions of objects in memory.
|
# ? Nov 16, 2013 00:42 |
|
Suspicious Dish posted:Try #openshift on Freenode? TangoWithDjango demonstrates cwd, which is what was screwing it up. It has to do with Openshift's nested directory structure. Here's an example working application file: Python code:
|
# ? Nov 16, 2013 10:48 |
|
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 |
For those of you that use virtualenv-burrito, is there any reason I wouldn't want to source /home/fletcher/.venvburrito/startup.sh automatically when a shell is opened? Is ~/.bashrc the right place for that kind of thing?
|
|
# ? Nov 23, 2013 03:55 |
|
Hed posted: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 23, 2013 12:34 |
What are some good libraries to look at for caching models and querysets? django-cache-machine looks pretty nice. Or should I just use the low level caching API built into Django and just cache a few specific things here and there?
|
|
# ? Nov 26, 2013 20:37 |
|
I've never had a problem with johnny-cache.
|
# ? Nov 26, 2013 20:50 |
It's safe to leave django-debug-toolbar in INSTALLED_APPS and MIDDLEWARE_CLASSES on production right? I know it's not supposed to do anything when DEBUG = False but I just wanted to double check.
|
|
# ? Nov 26, 2013 23:47 |
|
What are peoples' thoughts on PythonAnywhere? It seems like an affordable enough PaaS if you don't mind getting your hands a bit dirty.
|
# ? Nov 28, 2013 22:26 |
|
Are there any decent tutorial kind of things? Ive done the official pools one, and i like what ive seen. Ive used various unclean web stuff before, but im nowhere near experienced. Django book looks awfully outdated at this point. My endish goal is small ecommerce kind of site if that changes anything.
|
# ? Nov 30, 2013 23:46 |
|
evilentity posted:Are there any decent tutorial kind of things? Ive done the official pools one, and i like what ive seen. Ive used various unclean web stuff before, but im nowhere near experienced. Django book looks awfully outdated at this point. My endish goal is small ecommerce kind of site if that changes anything. The book Two Scoops of Django might be a good place to go after the official tutorial, or maybe Test Drive Web Development with Python (look for the free version link on that page).
|
# ? Dec 1, 2013 08:07 |
|
Thermopyle posted:The book Two Scoops of Django might be a good place to go after the official tutorial, or maybe Test Drive Web Development with Python (look for the free version link on that page). Two Scoops might be a bit advanced depending on how comfortable you are with Python. Tango With Django fit nicely between the official tutorial and Two Scoops for me.
|
# ? Dec 1, 2013 19:08 |
|
fidel sarcastro posted:Two Scoops might be a bit advanced depending on how comfortable you are with Python. Tango With Django fit nicely between the official tutorial and Two Scoops for me. Yeah, you might be right. Two Scoops came out after I was more advanced with Django, and it's kind of hard to slot that in to my what-did-i-understand-at-what-stage model. Anyway, I think people should read Two Scoops once they can understand what's going on it. I think MonkeyMaker recommended it at some point in here originally...
|
# ? Dec 1, 2013 20:36 |
|
Thermopyle posted:Anyway, I think people should read Two Scoops once they can understand what's going on it. I think MonkeyMaker recommended it at some point in here originally... Agreed. It's an excellent book.
|
# ? Dec 1, 2013 21:02 |
|
Im quite comfortable, ill check out all 3 books, cheers.
|
# ? Dec 1, 2013 21:31 |
I'm playing around with django-mptt and I want cheap access to len(node.get_children()) so I don't have execute N queries to get the children count of N nodes. Any suggestions for how to go about this? I was thinking I might have to just add a children_count field on the model and calculate it in a cron job that runs in the background. I don't need this value to always be up to date, it's fine if there is a bit of a delay on it. I started going down the route of trying to cache the serialized response data to at least reduce the frequency that those N queries get executed, but it started to feel not quite right. edit: Nevermind, I just shoved it in memcached and called it a day. Don't want to spend forever trying to optimize this just yet. fletcher fucked around with this message at 23:48 on Dec 5, 2013 |
|
# ? Dec 5, 2013 03:35 |
|
I'm trying to model a Log using ORM, and I'm a bit confused on how. I want to make a log object with four individual parts, each with its own set of fields (some with text input, some with character input and associated integers). So far, I've managed to define a log object and two of the four steps. Is this approach correct? Will this end up with a log in several parts, or something totally different? How do I make it so the second step can hold multiple feeling attributes and associated integers? EDIT: Changed the code. It's different now. Still asking for advice... Python code:
Pollyanna fucked around with this message at 01:56 on Dec 6, 2013 |
# ? Dec 6, 2013 01:53 |
|
Pollyanna posted:I'm trying to model a Log using ORM, and I'm a bit confused on how. I want to make a log object with four individual parts, each with its own set of fields (some with text input, some with character input and associated integers). So far, I've managed to define a log object and two of the four steps. Is this approach correct? Will this end up with a log in several parts, or something totally different? I don't quite understand your problem, but your Unicode methods are going to have a hard time finding the non-existent name' property. As to your problem, are these four distinct Log objects that are related, or a single Log object that will have its properties set at different times? If the former, I would create a Log object that has four LogPart properties on it, and then have subclasses of LogPart for the individual bits. If the latter, just put al the properties on it and have them be optional, then populate them over time. EDIT: I replied befor your edit, so seems like you are going for the latter.
|
# ? Dec 6, 2013 02:01 |
|
Lumpy posted:EDIT: I replied befor your edit, so seems like you are going for the latter. Yup, that's it. This is the model for the, uh...model. What I'm stuck on right now is having multiple feeling attributes at the same time, and each one having an associated integer. Is there an equivalent for a dictionary in this case...?
|
# ? Dec 6, 2013 02:07 |
I think something like this might also work. Basically since you want each MoodLog to be able to have multiple Feeling & Rating combos associated with it, those could be their own model, with a key that points back to the MoodLog they are associated with. Django then makes it easy to query the relationships between these tables.Python code:
code:
code:
code:
code:
|
|
# ? Dec 6, 2013 03:06 |
|
Dang, that kinda makes sense. I changed yours around a bit, here's what I got:Python code:
code:
Also, is there an easier way to mess around with models without having to destroy and recreate your database? edit: Aha! I needed to add a related_name for each individual Thought. Python code:
Pollyanna fucked around with this message at 04:51 on Dec 6, 2013 |
# ? Dec 6, 2013 04:23 |
edit: hah you beat me Pollyanna posted:Syncing the DB gives me this error, though: Since you have multiple foreign keys to Thought, Django is getting confused when it tries to create that *_set accessor, because they all end up with the same default name. Fortunately Django lets you specify a name, so they don't clash. Simplest way is to fix it is to tell Django not to create those *_set accessors, but doing: Python code:
Python code:
Python code:
code:
|
|
# ? Dec 6, 2013 05:04 |
As far as not having to blow away your DB when you are playing around, you could use something like South. I find myself using the "iteratively working on a migration" workflow a lot when I'm playing around with things. You don't have to use that though, you could simply just make a little python script that creates all your data, so after you blow away your database you can just run your little "generate some data" script.
|
|
# ? Dec 6, 2013 05:09 |
|
Suh-weet. Got it working. Except for one thing... In the admin interface, I expected it to have a char and integer field when I go to edit automatic/revised thoughts, but instead it looks like this: I'll prolly have to go digging into changing the admin interface, but at least the models are working. Also, I'm not sure how to add more negative feelings to an associated log, or at least I don't know how to get that to show up on the admin site.
|
# ? Dec 6, 2013 05:10 |
|
Pollyanna posted:Suh-weet. Got it working. Except for one thing... Have a look in the admin documentation. The thing you're looking for is admin.TabularInline.
|
# ? Dec 6, 2013 06:28 |
|
Maluco Marinero posted:Have a look in the admin documentation. The thing you're looking for is admin.TabularInline. All my attempts at getting that to work ended in failure. I'm moving to the original setup for now but I still want to fix this eventually.
|
# ? Dec 6, 2013 06:50 |
|
|
# ? May 16, 2024 19:03 |
|
Pollyanna posted:All my attempts at getting that to work ended in failure. I'm moving to the original setup for now but I still want to fix this eventually. Show me your current admin code and I'll see how I can help.
|
# ? Dec 6, 2013 08:33 |