|
MEAT TREAT posted:I really liked WebFaction the last time I had to use Django. At the time they were just rolling out some new sever scaling features but it looked promising. I know they offer MySQL databases, but I'm not sure what else. Going with this too. Other than a few oddball file locations (It is, after all a shared host rather than vhost setup) , its really configurable, and if theres something that aint working right, the support is one of the best I've encountered. Its some sort of variant of chroot jail setup, and get a shell account which can be used to install stuff into your jail, and so on. Just be a bit wary the documentations a little iffy regarding python version types sometimes.
|
# ? Aug 25, 2011 10:38 |
|
|
# ? May 16, 2024 09:39 |
|
Possible heresy incoming.... I wonder how difficult it would be to write a django template tag that does this {% python %} bunch of embedded python {% endpython %} Normally that sort of things bad form, but sometimes django template system really shits me with its lack of features. It would enable php-esque shittiness, but a contract in a hurry sometimes demands shittiness. Naturally you wouldn't want something like this to occur {% python %} for item in blah: {% endpython %} Blah html {% python %} ??????? {% endpython %} Because it'd just end up confusing the block indentation stuff, but as long as whats in between the tags is more or less self contained, it would probably just be implementable with an eval() call. I think. . . . .
|
# ? Aug 25, 2011 10:48 |
|
It probably wouldn't be hard, but what are you really struggling with? The only problem I've had with Django's template language is the lack of variable assignment, which I ended up writing a dodgy template tag to solve.
|
# ? Aug 25, 2011 12:36 |
|
raymond posted:It probably wouldn't be hard, but what are you really struggling with? The only problem I've had with Django's template language is the lack of variable assignment, which I ended up writing a dodgy template tag to solve. can't you just use the {% with %} tag for that? duckmonster, what do you find yourself unable to do with template tags and filters?
|
# ? Aug 25, 2011 13:21 |
|
German Joey posted:can't you just use the {% with %} tag for that? The "with" tag is too limited. This might not mean much, but here is one way it has been used: code:
I'm going to ask my manager if I can start a work blog to post stuff like this. Then I would be able to show the actual template tag source code.
|
# ? Aug 25, 2011 14:00 |
|
Just look at Jinja2, raymond. As far as I remember, it lets you do a lot more Python in the templates than Django's templating engine does (both by design).
|
# ? Aug 25, 2011 17:01 |
|
Oh its definately a design decision on Djangos behalf. The template language is intentionally sparse to try and enforce a logic/presentation separation, and 90% of the time thats a very good thing. My favorite template system back when I was doing PHP dev was this thing called "Sigma" that was incredibly simple. Variable substitutions and blocks. If you need the block to repeat, you processed it twice in the code. It made for *very* simple templates that even the dumbest graphic designer could understand. The problem though with simple syntaxes is that when you want to do something really loving unusual you end up either with a stupidly complex amount of tag fuckery, or having to write a template tag, or alternatively pushing display logic back into the view. And thats where it becomes problematic. A good view/template arangement OUGHT allow you to just rewrite the template to have an entirely different presentation whilst leaving the view to just prepare the data. When you have to massage the data to fit a certain template , its problematic. Thus it'd be nice to be able to go "Ok, we're swapping in a new template but it kind of needs some massaging (like maybe calculating a percentage or something) to allow the simple template model to cope with it. Being able to drop in a bit of python to massage it means that you dont have to rewrite views, just the template. Its a weapon of last resort , strictly for when the deadlines too short to go loving around with hairy template tag semantics, but it'd be a loving handy weapon to have, as just a third-party template processor that can be optionally added in and used when needed. e: I think it was called sigma, its been a long time since I've been a PHP dev. gently caress php.
|
# ? Aug 26, 2011 05:49 |
|
e: gently caress it, I'm not fixing this problem, I'm just not going to use green unicorn for debugging that page
duck monster fucked around with this message at 06:20 on Aug 26, 2011 |
# ? Aug 26, 2011 06:15 |
|
like, i still don't get it. what can you not do just by writing a few new template tags/filters? those are your supposed to be inline "evals," for content not generated in the view, right there! what is "stupidly complex amount of tag fuckery" supposed to mean? tags and filters are so loving simple. what the gently caress kind of situation do you need a literal "eval" block for?
|
# ? Aug 26, 2011 08:31 |
|
German Joey posted:like, i still don't get it. what can you not do just by writing a few new template tags/filters? those are your supposed to be inline "evals," for content not generated in the view, right there! what is "stupidly complex amount of tag fuckery" supposed to mean? tags and filters are so loving simple. what the gently caress kind of situation do you need a literal "eval" block for? Well it'd be a personal convenience. Due to the complete inadequacy of the built in webserver in django (Serious, put even the slightest bit of pressure on the loving thing and it implodes) I usually use green unicorn to debug, which means I have to stop and restart django each code revision. Since templates are not cached (if you dont ask it to) , fiddlefucking around with some {% inline %} poo poo would be faster. Its just a convenience. Plus to be honest, custom tags arent THAT much simpler, since the code aint in the same place.
|
# ? Aug 26, 2011 09:27 |
|
Is sending a SIGHUP to your gunicorn process really that much effort?
|
# ? Aug 26, 2011 09:42 |
|
The template writer in me wants to retch at that {% assign %} tag. I'm glad that it works for you and yours, but at that point, I'd be seriously rethinking why it needs to be like that (time constraints aside).duck monster posted:Thus it'd be nice to be able to go "Ok, we're swapping in a new template but it kind of needs some massaging (like maybe calculating a percentage or something) to allow the simple template model to cope with it. Being able to drop in a bit of python to massage it means that you dont have to rewrite views, just the template. I do wish the method built into Django for writing templatetags was less goddamn painful though, and I can see why, given the absence of various apps that improve it, you'd want to avoid it.
|
# ? Aug 26, 2011 10:06 |
|
nm
epswing fucked around with this message at 14:24 on Aug 27, 2011 |
# ? Aug 26, 2011 10:37 |
|
duck monster posted:Well it'd be a personal convenience. Due to the complete inadequacy of the built in webserver in django (Serious, put even the slightest bit of pressure on the loving thing and it implodes) I usually use green unicorn to debug, which means I have to stop and restart django each code revision. Since templates are not cached (if you dont ask it to) , fiddlefucking around with some {% inline %} poo poo would be faster. I use the runserver_plus command from django-command-extensions, which uses the astonishingly great wsgi debugging server from Werkzeug instead of the built in django http server. shell_plus is really handy too. Check it out, you might like it better than gunicorn.
|
# ? Aug 26, 2011 14:25 |
|
Does anyone use an IDE with a debugger, allowing them to step through djando code? I remember attempting this with the community version of Wing and it never worked properly (or I was doing something wrong).
|
# ? Aug 26, 2011 14:27 |
|
epswing posted:Does anyone use an IDE with a debugger, allowing them to step through djando code? I use ipdb, and just stick in a call to ipdb.set_trace() wherever I want to start debugging. Whatever terminal you have runserver/runserver_plus running in will just turn into a debugging console.
|
# ? Aug 26, 2011 14:30 |
|
epswing posted:Does anyone use an IDE with a debugger, allowing them to step through djando code? I remember attempting this with the community version of Wing and it never worked properly (or I was doing something wrong). Wings is terrible and shouldn't be used by anyone.
|
# ? Aug 26, 2011 14:36 |
|
duck monster posted:Wings is terrible and shouldn't be used by anyone. Ok, recommend me an IDE that supports debugging python/django. Don't say eclipse. (PS, for dynamically typed languages I've only ever used a straight text editor. It would be useful to step through the code sometimes, though...for example, my recursion problem above, I don't know what the gently caress.)
|
# ? Aug 26, 2011 14:49 |
|
epswing posted:Ok, recommend me an IDE that supports debugging python/django. Don't say eclipse. PyCharms. Worship the nectar of Jet Brain!
|
# ? Aug 26, 2011 15:27 |
|
Yay posted:The template writer in me wants to retch at that {% assign %} tag. I'm glad that it works for you and yours, but at that point, I'd be seriously rethinking why it needs to be like that (time constraints aside). It is absolutely about time constraints! I totally agree that the {% assign %} tag is not ideal, but it allows the frontend developers (who generally don't know Python) to solve more problems than normal. Before I made it, people were making "prefix" and "suffix" arguments for lots of template tags. There are template tags that take like 10 optional arguments. I actually introduced the idea of keyword arguments in template tags (!!!). Some of the existing tags make me want to throw chairs at the desks of everyone that was made redundant this week. I have been there for nearly 3 years and this so low on the priority list that I haven't even thought of it until now. I have some issues to work through, but at least I haven't resorted to an eval template tag.
|
# ? Aug 26, 2011 17:26 |
|
duck monster posted:Its just a convenience. I can't tell if you're not used to writing them, or just don't like them. I never blame the template system when I find something difficult to solve.
|
# ? Aug 26, 2011 17:46 |
|
While I can understand some frustration with it, I've never had a problem with PyDev. Especially since I can integrate nicely with my Fabric scripts.
|
# ? Aug 27, 2011 06:57 |
|
Captain Capacitor posted:While I can understand some frustration with it, I've never had a problem with PyDev. Especially since I can integrate nicely with my Fabric scripts. What has pydev got to do with your fabric scripts?
|
# ? Aug 27, 2011 08:55 |
|
Mulozon Empuri posted:What has pydev got to do with your fabric scripts? Not necessarily for me, but makes it easy to set up for designers working on the project. Define run/debug commands that just call the fabric script using command line/environment variables to distinguish between test and production.
|
# ? Aug 29, 2011 12:43 |
|
Hughlander posted:PyCharms. Worship the nectar of Jet Brain! Thanks for this recommendation. I've already used the debugger to locate a bug. I'll probably buy it.
|
# ? Aug 29, 2011 14:09 |
|
I have a 1.3 project that uses some legacy read-only databases in addition to the default. These databases should be used for the tests, no new versions should be created and torn down. Is the way to do this to extend DjangoTestSuiteRunner and override setup_databases and teardown_databases?
|
# ? Aug 29, 2011 23:20 |
|
Is there some sort of advanced inventorying solution for Django? So far I've found django-inventory and django-simple-inventory, but the former lacks a lot of features and the latter looks like it was put together in 10 minutes. I work for a school district that wants to be able to inventory all of our computers (right now our warehouse manager uses a Filemaker database, ugh), and populate data based on machine name using WMI. This includes storing a bunch of custom fields as well as the specs for each machine including the software installed on it. I figured no matter what solution I ended up with that I'd be programming the WMI portion myself, which is no big deal. I would just rather not write *all* of it completely from scratch.
|
# ? Aug 30, 2011 18:38 |
|
epswing posted:Ok, recommend me an IDE that supports debugging python/django. Don't say eclipse. The only problem I have with eclipse (and sadly its been a showstopper for me) is that it falls into a smouldering heap if its working on a network drive with an inconsistent connection. Which in my case is all the loving time (yay wireless), and recovers poorly from it. I'd say pycharm, but sadly it handles that even more poorly. The best I've come across so far has been sublime text 2 with the sublime port of Komodo's CodeIntel plugin. I have no idea if it debugs django directly but I'm usually working on a laptop with the dev server mounted via SMB. From looking around it doesn't natively do it, but since Sublime Text 2's plugins are done in python it ought be very straight forward to put together a plugin for it, especially since the plugin system seems pretty straight forward. There is a python console in it, but what would *rule* would be a way to pull up the django shell itself. Its a much simpler editor, but with the exception of debugging (And I tend to prefer handling that poo poo command line mainly out of "stubborn old dog" reasoning) it does almost everything essential whilst still feeling lightweight as hell. Ultimately its what bugs me with all the "heavy" ide's (other than my passionate hate for a "virtual" folder view that doesnt always reflect the file system reality without loving about with syncs etc) , is that I just want it to get out of my way and let me mash my sausagefingers into the keyboard, only popping up to offer tasty code completion morsels. Well that and telling me if I'm making an obvious dumbfuck move. ANOTHER QUESTION Is there a neat way of representing a true undirected (symmetrical) graph in M2M fields whilst still having an intermediate model to express things like edge weightings etc? I mean I can sort of fake it by just pretending its symetrical but theres all sorts of wierd implications like having to double process edges for INCOMING and OUTCOMING, then merging them and and and loving annoying (or add double edges but emulating symetry with double edges isnt actually the same as symetry in graph theory) e: Actuallyt I can't find an example anywhere of using an intermediate model on an UNsymetrical model, and have no idea how to tell django which foreign reference on the intermediate model is the parent and the child. loving django documentation! e: I'm just going to try it and if it works I'll just have to accept it works and shudder at the magic..... duck monster fucked around with this message at 07:03 on Sep 3, 2011 |
# ? Sep 3, 2011 06:37 |
|
Sometimes when I docode:
What's going on here? When I say 'sometimes', I mean with most views this doesn't happen, but with one in particular, it does. And there's nothing that I can see which differentiates them.
|
# ? Sep 4, 2011 02:22 |
|
Is this view missing the RequestContext? I think messages need that.
|
# ? Sep 4, 2011 03:42 |
|
raymond posted:Is this view missing the RequestContext? I think messages need that. Ohhh the target view needs a RequestContext. Thanks! Next Question! When I import classes from other apps in my project, I've always used from myapp.somefile import SomeClass but PyCharm wants me to use from myproject.myapp.somefile import SomeClass Pros/Cons? epswing fucked around with this message at 05:36 on Sep 4, 2011 |
# ? Sep 4, 2011 04:36 |
|
Explicitly referring to your project name from your apps is generally discouraged because it reduces the portability of your apps. Even if your apps aren't meant to be portable, I still wouldn't use it.
|
# ? Sep 4, 2011 10:16 |
|
epswing posted:Ohhh the target view needs a RequestContext. Thanks! Just throw the project directory into the python path. Refering to the projects name is bit of an anti-pattern for the reason mentioned above, but you shouldn't ever have to either.
|
# ? Sep 4, 2011 17:23 |
|
duck monster posted:Just throw the project directory into the python path. Refering to the projects name is bit of an anti-pattern for the reason mentioned above, but you shouldn't ever have to either. Doesn't manage.py do that for you?
|
# ? Sep 4, 2011 18:03 |
|
MEAT TREAT posted:Doesn't manage.py do that for you? I forget if it does or not, but regardless that only works if you are using manage.py
|
# ? Sep 4, 2011 18:43 |
|
MEAT TREAT posted:Doesn't manage.py do that for you? It ought to, but you can't necessarily expect for an IDE to be able to parse that out. It at the very least requires the IDE to "get" django.
|
# ? Sep 5, 2011 00:54 |
|
duck monster posted:It ought to, but you can't necessarily expect for an IDE to be able to parse that out. It at the very least requires the IDE to "get" django. I thought that's what they meant when they say that the IDE supports django.
|
# ? Sep 5, 2011 01:38 |
|
MEAT TREAT posted:I thought that's what they meant when they say that the IDE supports django. Normally supporting Django tends to be things like understanding the template language. Depending on their level of integration / features of the editor/ide it can also mean things like being able to introspect project paths, tab complete inside of setting strings, among some other misc features.
|
# ? Sep 5, 2011 15:59 |
|
Anyone here going to DjangoCon?
|
# ? Sep 5, 2011 18:45 |
|
|
# ? May 16, 2024 09:39 |
|
MonkeyMaker posted:Anyone here going to DjangoCon? I wish
|
# ? Sep 5, 2011 19:15 |