|
jupo posted:Anyone have any feedback on hosting django with http://webfaction.com ? They have an installer that gives you your own instance of Apache + mod_python or mod_wsgi and the Django trunk. You can stop and start Apache at will. WebFaction is one of the best shared Python hosts out there, in my opinion.
|
# ? Aug 24, 2008 04:42 |
|
|
# ? May 15, 2024 03:14 |
|
jupo posted:Anyone have any feedback on hosting django with http://webfaction.com ?
|
# ? Aug 24, 2008 04:43 |
|
Thanks guys, sounds like a winner.
|
# ? Aug 24, 2008 05:24 |
|
king_kilr posted:new docs stuff just hit django, you can check out the hotness at http://docs.djangoproject.com/ I can't say I like this presentation better than the other. The old version was a bit clearer to me. Took me a while to even begin looking for the templates reference. (And there are like 5 links for templates) More gripes: Still no official signals documentation. Still no clear "views" docs other than the stuff intermixed in the tutorial. Still no middleware dev docs. I do like that it has breadcrumbs now and that the template docs are slightly more organized. deimos fucked around with this message at 09:54 on Aug 24, 2008 |
# ? Aug 24, 2008 09:50 |
|
deimos posted:I can't say I like this presentation better than the other. The old version was a bit clearer to me. Took me a while to even begin looking for the templates reference. (And there are like 5 links for templates) My understanding was that they didn't actually add any new docs with this effort, simply switching to a new docs generator, tweaking the presentation a bit, and rearranging some material. That said, yea, I'm not sure I like it either, but hopefully that's just me being used to the old layout Signals: agreed, wish they'd document it already, they're very useful in some situations. There are clear "views" docs, the deal is that views are just Python functions...ones that take in requests and return responses, and thus the request/response docs are what you actually want. Middleware dev docs: right here
|
# ? Aug 24, 2008 13:57 |
|
bitprophet posted:There are clear "views" docs, the deal is that views are just Python functions...ones that take in requests and return responses, and thus the request/response docs are what you actually want. While I agree that the "views" docs are the request/response docs, it's not as easy for a newbie, can't just tell them "look at the request/response docs". With regards to the middleware docs: So that's where they went. I knew they were there before, now it's 3 clicks in with no reference to them within the front page. Usability overall of this iteration of the docs is... meh.
|
# ? Aug 24, 2008 17:33 |
|
I've been passing data to templates in urls.pl like: 'extra_context' : { 'news_articles': Article.objects.all().order_by('date')[:5] } but when the news articles are updated, the site isn't. How do I get around this? it only happens on the live server (using apache) and not on the built in dev server. Thanks!
|
# ? Aug 24, 2008 20:31 |
|
evilmonkeh posted:I've been passing data to templates in urls.pl like: URLconfs are only loaded once, when the server starts, and therefore any values calculated within them will only be executed that one time. This is commonly seen when you do e.g. {'timestamp': datetime.datetime.now()} for a context dict, and then find out the timestamp never changes So, the only "safe" values to set in URLconfs are ones guaranteed to truly yield their value later on, when called in the related view and/or template...like QuerySets, which are lazily evaluated: they only actually hit the DB and return results at the last possible moment, such as when you iterate over them...or when you slice them. Which is what you did in your code! All you need to do is have your news article template do the slicing instead of the URLconf, using the 'slice' template filter, and things should work. If this doesn't make sense, we can explain it further
|
# ? Aug 24, 2008 21:51 |
|
bitprophet posted:URLconfs are only loaded once, when the server starts, and therefore any values calculated within them will only be executed that one time. This is commonly seen when you do e.g. {'timestamp': datetime.datetime.now()} for a context dict, and then find out the timestamp never changes
|
# ? Aug 25, 2008 17:27 |
|
I love django. I was asked to make a CSV available of data for a date. Took less than 20 lines of code, illustrated here so that if anyone wants to use it they can (and if they can come up with a better way of doing the info_dicts they can tell me, I feel it's ugly):code:
code:
|
# ? Aug 25, 2008 19:12 |
|
Nice job The dict stuff, I can't see any other way to write it that's not equally verbose or more so. It'd be nice if you could make a dict via dict(otherdict, newkey=newval, newkey2=newval2) (i.e. combining the two behaviors of the dict() factory builtin instead of it being mapping-object-or-keys) but this really isn't too bad.
|
# ? Aug 25, 2008 22:03 |
|
deimos posted:Note: question.csv needs to have a BOM as the first character otherwise Excel will poo poo itself on unicode characters. Also, I broke the lines here but not in the file itself.
|
# ? Aug 26, 2008 00:35 |
|
Grey Area posted:Using the standard csv module would be more robust. I don't think it handles what he's talking about by default, but he could use a custom dialect/writer like this: http://www.djangosnippets.org/snippets/993/
|
# ? Aug 26, 2008 01:27 |
|
Milde posted:I don't think it handles what he's talking about by default, but he could use a custom dialect/writer like this: http://www.djangosnippets.org/snippets/993/ Nice link. And yeah the default CSV sucks at utf-8, I got tired of hacking it on a previous project so I went for the common case since everyone that's gonna use the app is gonna use it with excel. It was hacky but ffffff that. Also technically what I would need to write is a custom template filter and/or loader if I wanted to still use generic views, which was part of the point of this exercise.
|
# ? Aug 26, 2008 14:42 |
|
FINALLY got django working with MS SQL Server from a CentOS host. Recipe: code:
code:
code:
code:
code:
Adapted to the names above: code:
django-pyodbc - This site is almost empty of content. pyodbc - Has documentation of all the wrong things.
|
# ? Aug 26, 2008 18:27 |
|
deimos posted:
|
# ? Aug 27, 2008 14:44 |
|
Beta 2 is out.. feature freeze for 1.0. http://www.djangoproject.com/weblog/2008/aug/27/10-beta-2/
|
# ? Aug 27, 2008 16:20 |
|
When 1.0 rolls out, is it likely that if I upgrade my existing applications will work just fine (none of them use any particularly fancy or hackish features) or will there likely be some problems to crop up?
|
# ? Aug 27, 2008 17:49 |
|
Space Kimchi posted:When 1.0 rolls out, is it likely that if I upgrade my existing applications will work just fine (none of them use any particularly fancy or hackish features) or will there likely be some problems to crop up? From my perspective a lot of stuff is breaking, and I don't even have a big website to maintain, just a silly blog. I imagine the hardest part is that given the non-compiledness of Python, if you use some feature that's been removed, you won't know until you hit the specific area of a view that exercises it. A good argument for unit testing, I guess.
|
# ? Aug 27, 2008 18:30 |
|
Space Kimchi posted:When 1.0 rolls out, is it likely that if I upgrade my existing applications will work just fine (none of them use any particularly fancy or hackish features) or will there likely be some problems to crop up? I'm running trunk for new development and the pre-newforms-admin tag for everything before the merge (http://code.djangoproject.com/svn/django/tags/notable_moments/pre-newforms-admin/). I just symlink (well, junction on windows) to a different version when I need to.
|
# ? Aug 27, 2008 18:35 |
|
They're correct. The whole deal with Django 1.0 is that after 1.0, they'll be trying very hard to maintain backwards compatibility, such that users do not have to worry about stuff breaking when they upgrade to e.g. Django 1.1. Because of this, they've been breaking stuff left and right before 1.0 comes out, since they obviously can't do that nearly as much afterwards. Ergo, we've seen huge sweeping changes such as aforementioned newforms-admin, and lesser (but still backwards incompat) changes such as minor alterations to the file upload API. The semi canonical source for What's Broken is the BackwardsIncompatibleChanges page on the Django wiki. Give it a close read if/when you upgrade.
|
# ? Aug 27, 2008 19:26 |
|
Hmm. I'll take a look at that link. I'm not using newforms admin but on the bright side, I don't use the old one very much either, just for a few types of data objects that only need simple CRUD interfaces. Hopefully that will make things simple.
|
# ? Aug 27, 2008 21:36 |
|
Space Kimchi posted:When 1.0 rolls out, is it likely that if I upgrade my existing applications will work just fine (none of them use any particularly fancy or hackish features) or will there likely be some problems to crop up? Trunk has broken my projects at least 6 times in the past couple months as they've been trying to clean up the codebase.
|
# ? Aug 27, 2008 21:58 |
|
Space Kimchi posted:Hmm. I'll take a look at that link. I'm not using newforms admin but on the bright side, I don't use the old one very much either, just for a few types of data objects that only need simple CRUD interfaces. Hopefully that will make things simple. It's not just the admin -- if you're still using oldforms at all, that's out the window now (but good riddance!). Hopefully not, I think regular newforms hit trunk like a year+ ago, and it's just newforms-admin that hit more recently. It's all a blur at this point, I've seen so many big changes to the codebase I can't keep it straight Again, just skim down that list on the wiki page, it'll give you a good idea.
|
# ? Aug 28, 2008 01:15 |
|
The Real Ambassador posted:I dare you to get blob fields to work. One more thing to test. I've been running through django's test suite trying to fix stuff. bitprophet posted:It's not just the admin -- if you're still using oldforms at all, that's out the window now (but good riddance!). Hopefully not, I think regular newforms hit trunk like a year+ ago, and it's just newforms-admin that hit more recently. It's all a blur at this point, I've seen so many big changes to the codebase I can't keep it straight queryset-refactor bit me in the rear end even though I thought it was gonna be transparent.
|
# ? Aug 28, 2008 05:26 |
|
Ok, I'm going crazy here. I've setup Django correctly, my small test project loads and works fine with the built-in Django server. My problem is with Apache - it just won't work. I get this error in Apache: code:
code:
Here's my relevant Apache config: code:
Even the env variable is set correctly... code:
EDIT: Huuuh, I moved everything outside my home and put it in /opt, changed all the path definitions and now it works. Djangooooo Senso fucked around with this message at 22:11 on Aug 28, 2008 |
# ? Aug 28, 2008 21:24 |
|
Senso posted:EDIT: Huuuh, I moved everything outside my home and put it in /opt, changed all the path definitions and now it works. Djangooooo
|
# ? Aug 28, 2008 22:21 |
|
Senso posted:It's RIGHT THERE in my PythonPath! Senso posted:Even [my] env variable is set correctly... Your PythonPath and shell environment != Apache's PythonPath and shell environment. Two totally different things. That said, since you were adding the project directory (and, I assume /home/mlan/proj/project was your Django project root, and not /home/mlan/proj, otherwise that would be another problem) to Apache's PythonPath in your conf, I think NSW is correct, it was probably permissions. For example, even if your project has the right permissions, if your home directory does NOT, you're still hosed. So you'd need to make sure that www-data has +rx on /home, /home/mlan, and /home/mlan/proj, as well as the project dir. Moving it to /opt probably solved that problem for you (and fwiw it's nicer to keep stuff in /opt or /srv anyways ).
|
# ? Aug 29, 2008 00:42 |
|
bitprophet posted:Your PythonPath and shell environment != Apache's PythonPath and shell environment. Two totally different things. I know that but as you can see, I didn't take chances. PythonPath is defined in the VirtualHost Apache definition but I also defined it in bash, just to make sure. bitprophet posted:That said, since you were adding the project directory (and, I assume /home/mlan/proj/project was your Django project root, and not /home/mlan/proj, otherwise that would be another problem) to Apache's PythonPath in your conf, I think NSW is correct, it was probably permissions. Right, in the code I pasted, /home/mlan/proj was the Django root. /home/mlan/proj/myproject was the actual project. I read about that and I knew that I shouldn't give it the path of a single project. It probably was permissions after all. But the thing is, the django folders in /opt and in /home/mlan have the same permissions... And I'm a loving Linux sysadmin, I'm ashamed! Oh well, it works now.
|
# ? Aug 29, 2008 04:01 |
|
Senso posted:I know that but as you can see, I didn't take chances. PythonPath is defined in the VirtualHost Apache definition but I also defined it in bash, just to make sure. Sticky bit strikes again!
|
# ? Aug 29, 2008 04:20 |
|
Senso posted:It probably was permissions after all. But the thing is, the django folders in /opt and in /home/mlan have the same permissions... Did you read the last couple sentences of my post? even if the Django folders have the same perms, that doesn't mean jack if the parent directories are more restrictive (at least, in my experience and double-checking I did before posting to make sure I wasn't misremembering...). Senso posted:I also defined it in bash, just to make sure. If you're really a Linux sysadmin by trade, you should probably brush up on how the system works, to a decent level Your bash environment is in no way connected to the environment Apache runs in, unless you're running in something like sudo -u www-data /bin/bash, and even that isn't necessarily going to give you the 100% same environment, unfortunately.
|
# ? Aug 29, 2008 14:42 |
|
Yeah the python path thing can be whack. All sorts of python frameworks do it to (Webware for python, a tomcat style stack , does the same) but it really is for the best. The best thing you can do for your security is to keep the python path AWAY from your main module hidey hole , and just bring in the standard modules it needs. That way if someone somehow manages to code inject or exploit an exec or something then you at least minimise the damage. Its only a mild protection, but if you combine it with , say , a chroot jail, you can pretty much wall off a section of your server thats public facing. Of course all the cool kids serve out of vhosts these days anyway, so its probably moot.
|
# ? Aug 30, 2008 06:41 |
|
Thought I'd bump this for RC1! http://www.djangoproject.com/weblog/2008/sep/02/10-rc1/ Also, I've got a question regarding payment gateways.. I need to integrate one into a project I'm working on.. are there any out there that I can just plug in? What's the easiest to integrate with? Paypal? Authorize.net? Pros & cons?
|
# ? Sep 3, 2008 03:51 |
|
mwarkentin posted:Thought I'd bump this for RC1! http://www.djangoproject.com/weblog/2008/sep/02/10-rc1/ I don't know about the pros and cons of each but satchmo(django store app)(satchmoproject.com) has a ton of support for various gateways built in, so you can probably steal code from them for whatever you are working on.
|
# ? Sep 3, 2008 04:18 |
|
mwarkentin posted:Thought I'd bump this for RC1! http://www.djangoproject.com/weblog/2008/sep/02/10-rc1/ I use: http://pypi.python.org/pypi/zc.authorizedotnet/1.3 I had to write a hack to be able to do AUTH_CAPTURE transactions though: code:
|
# ? Sep 3, 2008 09:02 |
|
Django 1.0 is final Release notes with what's new edit: also Blog post! No Safe Word fucked around with this message at 02:24 on Sep 4, 2008 |
# ? Sep 4, 2008 02:18 |
|
I've had an idea for a web application for a while and I've finally gotten around to trying to build it. I've also been meaning to play around with Django so I've killed two birds with one stone. The past two days or so I've been playing around with bits and pieces for Django and I think I'm starting to get a handle on things, the documentation that is available is wonderful. Basically my application allows musicians to work on songs. Each song is comprised of various snippets, the ordering of the snippets would allow multiple instances in the song (eg chorus) and not all snippets would make it into the final version. I'm having a bit of troubling coming up with how to handle the song ordering in my model. This is what I have at the moment: code:
The admin interface is allowing me to add two items in the same position and ordering by song only. Am I going about this the right way?
|
# ? Sep 4, 2008 15:45 |
|
First off, you seem to be using Django 0.96, you should almost definitely get 1.0 which just came out. Gigantic differences. 0.96 is approaching two years old at this point. Second, unique_together (if it's still valid, I don't recall if it got axed/changed since then) should be in your Meta class. The only stuff that's not a function or inside Admin/Meta classes, are fields, and I don't think you mean to have a field called "unique_together"
|
# ? Sep 4, 2008 18:00 |
|
Ok. Python Oldie, but Django newbie question ahead: I'm building a django app that will have a series of test cases tracked within it (yay it will be open source). Each test case has a an object (from the model) that looks like this: code:
A "procedure" (as related to the test case) can have multiple ProcedureSteps associated with it. A procedure "step" could be related to multiple test cases. This is "easy" in that I can just add a bunch of ProcedureSteps to the table, and use the Django admin to create a select box. However, what I need is to keep the list of ProcedureSteps for the TestCase enumerated - step 1 must always be step 1. I also want to create an admin form which starts with 2 "edit" rows for the procedure attribute of the test case, and users can "add" a step. I also don't want to create a "procedure table" for each test case - that seems excessive for something that could have 100k+ entries in the test case table. The steps then must be stored and then displayed in the same order they were added to the test case. I want to shared all previously entered ProcedureStep with all new and old test cases, so people can pick from a category of steps, then select a pre-entered ProcedureStep. So, I'm not terribly good with databases - or django. Any of you have a suggestion on how to structure the model and possibly render this in the admin? I feel stupid. m0nk3yz fucked around with this message at 18:49 on Sep 4, 2008 |
# ? Sep 4, 2008 18:43 |
|
|
# ? May 15, 2024 03:14 |
|
bitprophet posted:First off, you seem to be using Django 0.96, you should almost definitely get 1.0 which just came out. Gigantic differences. 0.96 is approaching two years old at this point. Ughh, I can't believe I actually posted that, I had read and understood that was the point of the Meta class but acting on that information seemed to be a stumbling block. I was using 0.96, I was kind of scared that upgrading would break everything that I had done the day before but I've done so now and figured out all the new stuff.
|
# ? Sep 5, 2008 09:42 |