|
That's a beautiful tutorial, ATL. I look forward to this thread. If anyone's using a version past .96 however, max_length has replaced maxlength.
|
# ? Mar 8, 2008 03:16 |
|
|
# ? May 16, 2024 18:49 |
|
I am trying to extend the User model and implement django-profiles so that my users can CRUD their own accounts at will. Update: I found the error was in AUTH_PROFILE_MODULE, I was referencing my project instead of the application that has UserProfile defined in it. Edit: nevermind Nolgthorn fucked around with this message at 17:40 on Mar 8, 2008 |
# ? Mar 8, 2008 16:02 |
|
I'm hugely impressed with the admin thing. In about a day I've gone from never having touched Python to having built a whole working admin system for my site with 15 connected tables. Hopefully deploying the thing will be as easy...
|
# ? Mar 8, 2008 23:12 |
|
Oben posted:I'm hugely impressed with the admin thing. In about a day I've gone from never having touched Python to having built a whole working admin system for my site with 15 connected tables. Hopefully deploying the thing will be as easy... Its not painful but its no party.
|
# ? Mar 8, 2008 23:14 |
|
ashgromnies posted:
WebFaction is awesome. I love it, its so cheap and easy to use. They give you your own version of apache and the django support is amazing. 99% of the stuff is set up for you just with the one click installers. I am not the only one http://blog.awarelabs.com/?p=41 If you feel like throwing a little love my way http://www.webfaction.com/?affiliate=apodysophilia
|
# ? Mar 9, 2008 02:25 |
|
Is there a decent guide to running this on shared hosting somewhere out there? It looks like the Django guys are just giving shared host users the finger, which is kinda mean, haha. On my host, Django couldn't find psycopg or psycopg2 so I decided to just install python out of my /home directory. I was successful in getting python running and I've been able to then get django going on top of it. I can do django-admin.py syncdb with my project, too, and it definitely is connecting to my db ok. The problem I'm having is I can't seem to view anything from a web browser. I've been reading the guides on using .htaccess and mysite.fcgi but can't seem to get it to work. All I get when I load the page is a blank page that takes forever to load. My logs for the subdomain it's on don't seem to indicate any errors. Are there any good guides out there on running on a shared host? I imagine I'm going to have more problems since I'm running python and everything else out of /home. edit: Forgot to mention this is on Steadfast blorpy fucked around with this message at 23:26 on Mar 9, 2008 |
# ? Mar 9, 2008 23:17 |
|
Who is your shard host? Most of them have their own specific instructions. This thread: http://groups.google.com/group/django-users/browse_thread/thread/68c21aab73d212ff has some good info for the various shared hosts.
|
# ? Mar 9, 2008 23:24 |
|
Finally, I got it working. Looks like being on a shared host can be tricky.
blorpy fucked around with this message at 11:38 on Mar 10, 2008 |
# ? Mar 10, 2008 09:17 |
|
I think I'm doing something wrong... I just started with Django and got everything set up and got the administrative interface working. My Project is named "mysite" and my App is "blog". I opened up czubus/settings.py and added "blog" to the INSTALLED_APPS array, but now I get an error: ImproperlyConfigured: Error importing middleware django.contrib.sessions.middleware: "No module named blog" It makes me think it's in the wrong namespace or a path is misconfigured somewhere, but I don't know where to start looking. edit: Ahah, got it... turns out I was right - it was in the wrong namespace, so I had to put "mysite.blog" instead of just "blog" in the INSTALLED_APPS. You might want to change that in the tutorial
|
# ? Mar 11, 2008 01:16 |
|
I'm still just getting my toes wet with web programming, but it looks like Ruby on Rails has some nice shortcuts for using Prototype and script.aculo.us. I've read the B-List articles about doing AJAX with Django from back in fall of '06, but it seems relatively complex. Are there any shortcuts for integrating all that 'Web 2.0' jazz on Django these days, or is it still a mostly manual process requiring a fair amount of javascript coding?
|
# ? Mar 11, 2008 02:36 |
|
Neurozys posted:I'm still just getting my toes wet with web programming, but it looks like Ruby on Rails has some nice shortcuts for using Prototype and script.aculo.us. I've read the B-List articles about doing AJAX with Django from back in fall of '06, but it seems relatively complex. Are there any shortcuts for integrating all that 'Web 2.0' jazz on Django these days, or is it still a mostly manual process requiring a fair amount of javascript coding? Yes, Django won't write your javascript, it also doesn't lock you into using a specific toolkit, so you can use YUI, Dojo, jQuery, whatever.
|
# ? Mar 11, 2008 02:53 |
|
ashgromnies posted:I think I'm doing something wrong... I just started with Django and got everything set up and got the administrative interface working. What does your directory and file layout look like? Because adding just app_name to INSTALLED_APPS wihtout prefixing it with the site name should work, at least it works for me.
|
# ? Mar 11, 2008 09:08 |
|
Is there a good way of creating "HTML helpers", in the way that Rails does it, so that I could type {% paginnnnnnnnnnnator %} and have that just read from another template? Do I just need to include it on the page then and what does the code look like to do that? What if I'm calling it multiple times in the same page, is there a way to do it properly with a minimal of code and duplication? Can I pass arguments?
|
# ? Mar 11, 2008 09:19 |
|
Sure, you can do all of that, take a look at this part of the documentation, it explains how it works quite nicely.
|
# ? Mar 11, 2008 09:30 |
|
Nolgthorn posted:Is there a good way of creating "HTML helpers", in the way that Rails does it, so that I could type {% paginnnnnnnnnnnator %} and have that just read from another template? Do I just need to include it on the page then and what does the code look like to do that? First off, for actual custom template tags, see Bonus' link. However, if what you want is for {% paginnnnnnnnator %} to "read from another template" then you want the built-in template tags {% include %} (for literal including) or {% block %}/{% extends %} (for a fill-in-the-holes approach). I mean I guess you could make your own template tag that's simply a shortcut for {% include "specific/template.html" %} but I'd say that's just silly
|
# ? Mar 11, 2008 15:27 |
|
Bonus posted:What does your directory and file layout look like? Because adding just app_name to INSTALLED_APPS wihtout prefixing it with the site name should work, at least it works for me. code:
code:
code:
(1054, "Unknown column 'blog_blogpost.Featured' in 'field list'") What do I need to do to get it to really sync and add that column to the table? edit: oh, the docs! code:
|
# ? Mar 11, 2008 20:08 |
|
If you want something similar to Rails' migrations, check out django-evolution: http://code.google.com/p/django-evolution/
|
# ? Mar 11, 2008 20:22 |
|
ashgromnies posted:
Yeah.. Thats a knock for Django right now. Especially during rapidly changing developments. It's hard to alter schemas quickly and efficiently. It's currently an open issue in the dev group of the Django Project - http://code.djangoproject.com/wiki/SchemaEvolution There also is some community code contribution that helps this out a bit as well - http://code.google.com/p/django-evolution/
|
# ? Mar 11, 2008 20:23 |
|
ATLbeer posted:Yeah.. Thats a knock for Django right now. Especially during rapidly changing developments. It's hard to alter schemas quickly and efficiently. Ah, okay, I see. I updated my version of Django to the svn-trunk version(my hosting company gave me 0.96) and grabbed django-evolution from their repository and everything seems to work awesome now. Thanks! Okay, now I have a weird issue with the way Django is escaping my output, I think... it didn't happen when I was running 0.96 but basically I put TinyMCE on my admin page so that I had a WYSIWYG editor for my blog posts, and it stores to the database fine, but then when I print it to the template... code:
For reference, here's the HTML inside the PostText... code:
|
# ? Mar 11, 2008 22:08 |
|
After .96 all html gets escaped, you need to disable auto-escaping. See here.
|
# ? Mar 11, 2008 22:16 |
|
deimos posted:After .96 all html gets escaped, you need to disable auto-escaping. That's the ticket! Thanks a lot. Now to write my own custom version of the truncatewords_html filter to create a link to the full article based on its slug... I'm underway!
|
# ? Mar 11, 2008 23:12 |
|
For anyone who's interested I've been working on building a plugin system for django. It's still a work in progress, but it should work. You can check it out here: http://github.com/alex/django-plugins/tree/master
|
# ? Mar 11, 2008 23:56 |
|
I've stumbled across a weird bug in Django that I can't reproduce reliably. It appears to be an error with the way it's handling regular expressions or something. Occasionally when I enter the path http://mysite.com/admin, it redirects me to a "cannot load view page" for the view "article_detail" which is linked to in the mysite.blog urls, so I don't know how it can ever touch it. code:
ashgromnies fucked around with this message at 05:13 on Mar 12, 2008 |
# ? Mar 12, 2008 05:09 |
|
There shouldn't be a question mark after the '/' in admin.
|
# ? Mar 12, 2008 05:17 |
|
king_kilr posted:There shouldn't be a question mark after the '/' in admin. Why not? I want the question mark to be optional. In most regular expression engines(including Python's), the question mark means to match the preceding character zero or one times.
|
# ? Mar 12, 2008 13:51 |
|
ashgromnies posted:Why not? I want the question mark to be optional. In most regular expression engines(including Python's), the question mark means to match the preceding character zero or one times. Make sure the slash-appending behavior of CommonMiddleware isn't screwing you up. Typically, you should have APPEND_SLASH enabled in settings.py and just forget about trying to catch 'missing' slashes in your URLconf - there's no need for doing so and it'll give rise to issues like this. I'm guessing something unexpected is going on when interpreting your URL (again possibly caused by APPEND_SLASH behavior) and it's 'falling through' to your blogs URLconf. For example, if the admin and articles lines in your mail URLconf don't match (which seems to be what's happening) the URL dispatcher will end up in your blog URLconf (because it's catching the 'empty' regex). At any rate, I'm 99.9% sure that if you make sure APPEND_SLASH is on (and that CommonMiddleware is enabled, natch) and remove the question mark in your admin include regex, everything will work fine, for either https://www.mysite.com/admin or https://www.mysite.com/admin/.
|
# ? Mar 12, 2008 15:25 |
|
ashgromnies posted:Why not? I want the question mark to be optional. In most regular expression engines(including Python's), the question mark means to match the preceding character zero or one times. That's technically correct but I've found that it works best if you don't put the question mark after the slash and then Django will automatically append a slash if you haven't explicitly told Django not to (i.e. don't set APPEND_SLASH = False in settings.py) edit: ugh beaten. f u bitprophet
|
# ? Mar 12, 2008 15:28 |
|
just wanted to say thank you for this awesome tutorial. Just a minor nit-pick, the path structure used changes slightly and maybe combine some of the steps to see verifiable change. I'm sure I will be posting here with all sorts of questions in the following weeks/months
|
# ? Mar 12, 2008 17:50 |
|
Thanks, fellas. I'm learning Python as I do this as well, so it's a constant struggle edit: nvm i'm dumb i didn't realize the node parser part was necessary and handled wayyy deep down ashgromnies fucked around with this message at 18:26 on Mar 12, 2008 |
# ? Mar 12, 2008 18:20 |
|
Take 50 out of quotes, I'm pretty sure it is try to do this int(str("50")).
|
# ? Mar 12, 2008 18:27 |
|
king_kilr posted:Take 50 out of quotes, I'm pretty sure it is try to do this int(str("50")). I dunno if you posted in the right thread or not but, I'm a bit confused at what your trying to do there "50" itself is a string. There's no reason to cast it into a string str("50") again. - "50" == str("50") == True To cast the string "50" into an integer (as you said 'Take 50 out of quotes') you would just int("50") the str part is redundant.
|
# ? Mar 12, 2008 19:02 |
|
ATLbeer posted:I dunno if you posted in the right thread or not but, I'm a bit confused at what your trying to do there ashgromnies edited his post :P . My post isn't clear, I meant str("\"50\"")
|
# ? Mar 12, 2008 19:08 |
|
ATLbeer posted:I dunno if you posted in the right thread or not but, I'm a bit confused at what your trying to do there Yeah that wasn't even necessary. The problem was deeper down. Anyways, I have permalinks and an auto-summarize and link to full article tag now... neato! code:
code:
code:
code:
The exception handling in tags.py is particularly stupid
|
# ? Mar 12, 2008 23:17 |
|
What are you going to do in order to ensure that two of the same slugs aren't generated on the same day?
|
# ? Mar 13, 2008 04:52 |
|
Nolgthorn posted:What are you going to do in order to ensure that two of the same slugs aren't generated on the same day? Make them unique in the model, I suppose. slug = models.SlugField(prepopulate_from=('Title',),unique=True) However that means that the same slug can only be used once for the entire life of the application and removes the purpose of going YYYY/MM/DD/slug I will have to think about this. I'm at work right now and can't put too much thought into it, but that's a good consideration. I need to learn more about what functionality Django models offer me. Is there a way to make a composite key across DatePublished/Slug? edit: haiii http://code.djangoproject.com/wiki/MultipleColumnPrimaryKeys Hmm. Since multiple-column primary keys aren't allowed, it seems like I could override the save method of the BlogPost model to verify that no post exists on that day with that slug before saving and otherwise throw an exception. ashgromnies fucked around with this message at 17:06 on Mar 13, 2008 |
# ? Mar 13, 2008 16:50 |
|
Putting a Meta inner class inside a model and assigning unique_together fields effectively achieves the same thing as composite primary keys. They're not composite primary keys in the DB, but there's an index over both of them, so effectively it's the same.
|
# ? Mar 13, 2008 17:19 |
|
Bonus posted:Putting a Meta inner class inside a model and assigning unique_together fields effectively achieves the same thing as composite primary keys. They're not composite primary keys in the DB, but there's an index over both of them, so effectively it's the same. But how can I do that since the PublishDate is a DateTimeField and I only want to compare the day, month and year and not the time?
|
# ? Mar 13, 2008 18:10 |
|
ashgromnies posted:But how can I do that since the PublishDate is a DateTimeField and I only want to compare the day, month and year and not the time? http://www.djangoproject.com/documentation/model-api/#unique-for-date Would that be what you're looking for?
|
# ? Mar 13, 2008 18:23 |
|
greenskeleton posted:http://www.djangoproject.com/documentation/model-api/#unique-for-date Cool, I didn't even know such a thing existed, though: django docs posted:This is enforced at the Django admin-form level but not at the database level. So, useful, but not db-uniqueness-assuring.
|
# ? Mar 13, 2008 18:51 |
|
|
# ? May 16, 2024 18:49 |
|
greenskeleton posted:http://www.djangoproject.com/documentation/model-api/#unique-for-date Uhm, yes, precisely. Wow, Django is awesome. I need to reread the docs. It's not working for me though. I have the latest version of Django, yes. code:
I created a blog post through the admin interface with slug="test-post" then created a second one with slug="test-post" and they're both in there. ashgromnies fucked around with this message at 19:00 on Mar 13, 2008 |
# ? Mar 13, 2008 18:51 |