|
Thats a good start. Personally, running migrations blind is a bit too risky for my tastes. Some other things to think about adding: pip install new requirements, apache HUPs/touching your wsgi file. At my last gig, in addition to doing all of the above; we'd also backup (tgz) the existing code before doing any pulls from the repo. 2nd Rate Poster fucked around with this message at 02:32 on Feb 21, 2012 |
# ? Feb 21, 2012 02:24 |
|
|
# ? Jun 1, 2024 00:32 |
|
2nd Rate Poster posted:Personally, running migrations blind is a bit too risky for my tastes. I used to think that. But eventually I realized that NOT automating this process was too risky. Assuming you also have a test server.
|
# ? Feb 21, 2012 04:22 |
|
epswing posted:I used to think that. But eventually I realized that NOT automating this process was too risky. Assuming you also have a test server. Yep, as long as you can test the result prior to doing it live, you're not going to gently caress something up cause properly tested code is less fallible than doing it your self.
|
# ? Feb 21, 2012 04:29 |
|
2nd Rate Poster posted:Have you ran syncdb and any relevant migrations? I'll try to do the things you're suggesting and see if I can figure them out.
|
# ? Feb 21, 2012 13:47 |
|
Apologies if this is a really common question, as it is likely to be. I'm going through the Django tutorials (djangobook.com) and am doing fine outside of MySQL syntax / actual database manipulation that isn't Python magic. Is there any good and (relatively) brief MySQL-specific* tutorial that will get me familiar with some of the command line syntax? I don't really care to learn everything about SQL right now, but I also am unsure just how much information directly related to SQL is necessary to get some basic Django sites up and running. * On a related note, I've had a lot of trouble getting Django+MySQL+MySQLdb up and running on OS X. Does anyone have experience with this? StackOverflow answers seem inconsistent at best and I'm afraid I may have hosed something up beyond repair in my attempts to get it set up correctly. I've resorted to just using my netbook with MySQL for now, but would like to have a similar environment on my Mac.
|
# ? Feb 21, 2012 16:05 |
|
To be honest I have no idea how to use SQL. Like literally. this will have to change soon as I go further, but as it stands I've just used the Django ORM (Models) and phpMyAdmin for observing database action. I'm sure there's a better way, but I just haven't found not knowing eat up too much of my time yet, as Django abstracts that stuff away from you, and for simple sites you're unlikely to feel limited by it. This is probably more a by product of me previously working through Drupal, but hey, phpMyAdmin is a pretty good product to me. You could install this XAMPP stack and use the database from it if you're having dramas, comes with phpMyAdmin installed. I don't use it anymore (nginx, mysql, php now) but it makes for an easy start. http://www.apachefriends.org/en/xampp-macosx.html edit: Don't let this stop you spending some time learning SQL by the way, I'd have much preferred that I had done so. I'm a hobbyist trying to transfer to professional, and as a result have got gaps in my knowledge base (no tertiary ed, completely unrelated career until September last year) that I need to fill, which is regrettable but in the end I have only so many hours of the day and necessity tends to drive my learning. Maluco Marinero fucked around with this message at 17:06 on Feb 21, 2012 |
# ? Feb 21, 2012 16:54 |
|
etcetera08 posted:Apologies if this is a really common question, as it is likely to be. Short of creating the database in the first place there isn't really any SQL you need to do. It may be easier just to install PHPMyAdmin if you're not comfortable with the MySQL console. With regards to OS X, I've found it to be a pretty awkward platform to develop on, so much so that I have a dedicated Parallels VM that I do any kind of development work on rather than have to mess around with OS X. It's much easier being able to just apt-get install a few packages. The added advantage of this is you're then much closer to your deployment environment (in most cases).
|
# ? Feb 22, 2012 00:31 |
|
ryo posted:Short of creating the database in the first place there isn't really any SQL you need to do. It may be easier just to install PHPMyAdmin if you're not comfortable with the MySQL console. Homebrew fixes a lot of the awkwardness. Just `brew install postgresql` and `brew install mysql` or whatever and you're up and running.
|
# ? Feb 22, 2012 02:50 |
|
Seconding homebrew. It really makes the difference, and the only time I've had to sidestep it was trying to get the MySQL C headers for OSX server (which comes with MySQL, but doesn't include the headers). Beyond that, I actually can't recall having a relevant package not accessible via 'brew install X' && 'pip install Y' This is, admittedly, probably because I don't have wild requirements and dependencies for my development environment, though.
|
# ? Feb 22, 2012 19:17 |
|
You all are right, I definitely should have just used Homebrew. Now that I have some things somewhat half installed and not working correctly is there any hope of using brew to install over them? I don't want to gently caress things up beyond repair (although that may have already occurred). I also realize that's a stupidly complicated question that depends on what I've already hosed with, but I don't really know how Homebrew works very much. (On the topic of Homebrew covering all the necessary packages one needs, the only thing I've ever needed that I couldn't get through there was Ada. Which is probably a pretty rare need these days..)
|
# ? Feb 22, 2012 20:52 |
|
etcetera08 posted:You all are right, I definitely should have just used Homebrew. Now that I have some things somewhat half installed and not working correctly is there any hope of using brew to install over them? I don't want to gently caress things up beyond repair (although that may have already occurred). I also realize that's a stupidly complicated question that depends on what I've already hosed with, but I don't really know how Homebrew works very much. Can't comment on Ada, because...yeah, never needed it. As far as Homebrew fixing/not caring about what you did, it probably depends entirely on what you did. Mac OS X Lion, by default, comes with PostgreSQL installed (I'd recommend using PostgreSQL over MySQL any day), so if you really don't want to install anything and you just want an RDBMS, there's that option. If you installed MySQL and whatever else through DMG-packaged installers, you *should* have a way to uninstall them through the same (or maybe another download from the site?). If you downloaded source and compiled, there is often a `sudo make uninstall` or you can just figure out what was installed where (look at the config log) and manually delete the files. Be careful with this. *OR*, if they're just installed and not working at all, install with Homebrew and see if it matters. If they're not working, Homebrew shouldn't have a conflict.
|
# ? Feb 22, 2012 20:58 |
|
Has anyone played around with the test database system? How does it work, if I want a postgreSQL server where my normal one is code:
|
# ? Feb 29, 2012 22:22 |
|
ufarn posted:Has anyone played around with the test database system? I always just use the local in-memory sqlite db thing it does by default. That is to say, the settings file I use when running tests uses sqlite as the engine. Is there a reason you don't want to do that?
|
# ? Feb 29, 2012 22:25 |
|
Lamacq posted:I always just use the local in-memory sqlite db thing it does by default. That is to say, the settings file I use when running tests uses sqlite as the engine.
|
# ? Feb 29, 2012 22:35 |
|
ufarn posted:As my earlier posts in the thread attest, I have some problems with postgreSQL that I am still looking into - an error that only happens, when no models objects have been added to the fresh app. I never really use sqlite for deployment, so I prefer to use the database systems I use in the wild. Got it. Well the docs seem to say that the test runner will actually create a new database with the text 'test_' prepended to the database name for each database entry in your settings file, and presumably it uses the credentials found in that entry to attempt to create the database. So make sure the user 'postgres' has permission to create and drop databases on localhost and you should be all set. Alternatively if you don't want to give that user permission to drop databases b/c that's your production database user, then use a different settings file for testing and specify a different database user in there.
|
# ? Feb 29, 2012 22:52 |
|
This turned up on one my email lists today;- Not sure what his budget is but: http://lists.debian.org/debian-jobs/2012/03/msg00000.html Debian are doing gods own work, so if one of you take it, do it properly m'kay?
|
# ? Mar 1, 2012 12:48 |
|
Something my business partner posted today about our custom view and form mixins. Thought it might be handy to some of you. read it here
|
# ? Mar 1, 2012 21:56 |
|
MonkeyMaker posted:Something my business partner posted today about our custom view and form mixins. Thought it might be handy to some of you. Looking forward to reading closer and implementing this stuff once I'm back on the keyboard.
|
# ? Mar 1, 2012 22:50 |
|
I've been doing some work to come up with a quick interface for a backend system. I've been toying around with Nexus and Dajaxice. Aside from some growing pains it's been going fairly well. If anyone has any other projects that are in this general area, I'd love to hear about it
|
# ? Mar 2, 2012 02:04 |
|
MonkeyMaker posted:Something my business partner posted today about our custom view and form mixins. Thought it might be handy to some of you. Pretty nice blog post. Class based views are the greatest thing ever, I can't believe we went so long without. The documentation is still pretty weak imo.
|
# ? Mar 2, 2012 14:47 |
|
Hoping someone here can help me out with this. We host a whole bunch of Django sites and I'm trying to work out a decent deployment process that keeps things nice and simple. The issue currently is that we use S3 and CloudFront for all static files then deploy the Django app via Beanstalk (without the static files). The frustrations at the moment is having to run 'manage.py collectstatic' each time we make a change to any of the projects images. We are also setting cache headers on the CloudFront uploads to keep load time down but subsequently meaning that after running collectstatic, we then have to force invalidation on our CloudFront instance too. The whole process is far too involved and I was wondering if anyone had any suggestions on how to streamline the whole thing? I know in an ideal world collectstatic wouldn't be run until all static files are final and ready for deployment, but unfortunately things just don't always work out like that and changing the odd image or javascript here and there will always be an issue. I found an article on Google that suggests appending a timestamp/revision number for each individual static asset and combine that with a custom template tag but I'm not sure how I'd get Django to automatically declare a revision without resorting to manually update settings.py each time. Again, it's just another stage in the deployment and another thing for us to accidentally forget. Anyone have any suggestions?
|
# ? Mar 3, 2012 18:29 |
|
Hanpan posted:Hoping someone here can help me out with this. We host a whole bunch of Django sites and I'm trying to work out a decent deployment process that keeps things nice and simple. The issue currently is that we use S3 and CloudFront for all static files then deploy the Django app via Beanstalk (without the static files). I have not ran into your issue with images as we versioned them... but one approach you may want to consider is invalidation on s3. I think I'd just write a simple script to invalidate all the image files on each deploy. More details here: http://stackoverflow.com/questions/1268158/force-cloudfront-distribution-file-update
|
# ? Mar 3, 2012 18:47 |
|
OK, I'm having an issue with Django and manual transactions. My view code looks like:code:
Can anybody spot the bug? No? It turns out that any context processor that queries the database will break this code, as that sets the dirty state on the connection, and the decorator that wraps the function will make sure that the transaction state is clean, and error out if otherwise. Just another item on the "Reasons I hate Django" list. So any third-party apps that possibly use transactions like this are completely broken, because the docs are broken! There's no easy solution outside of forcing a clean state in all context processors that query the database. Why did I ever pick Django for this project...
|
# ? Mar 3, 2012 20:56 |
|
Hanpan posted:I found an article on Google that suggests appending a timestamp/revision number for each individual static asset and combine that with a custom template tag but I'm not sure how I'd get Django to automatically declare a revision without resorting to manually update settings.py each time. Again, it's just another stage in the deployment and another thing for us to accidentally forget. Are you using django.contrib.staticfiles or django-staticfiles? If you're using the latter (or upgrade to Django 1.4 when it comes out), take a look at the CachedStaticFilesStorage - it will take care of versioning of all static files, including images. http://django-staticfiles.readthedocs.org/en/latest/helpers/#staticfiles.storage.CachedStaticFilesStorage Note: I haven't had a chance to use this yet, but we're planning on it when 1.4 comes out.
|
# ? Mar 4, 2012 01:53 |
|
Aha, that looks perfect! I can't wait for 1.4 to land.
|
# ? Mar 4, 2012 02:47 |
|
My test cases were passing, but I was getting a 500 error on the server. You know why? Django monkey patches the transaction methods to disable them. WHY THE gently caress IS THIS OK? Your code should never act different under a test case. Every day I hate you more, Django.
|
# ? Mar 4, 2012 18:30 |
|
No heres a reason to hate django The only instance on the internet of an error I'm hunting down on some legacy code I found somewhere I'm trying to debug Some guy asks about it on IRC, presumably showing some pretty bad code code:
This is why open source gets a bad name. Total asocial cunts putting themselves in communications channels where beginners might come to. Bad and uncool. Keep the asperger suffers away from the interet support channels folks. If someone spoke to me like that in real life, I'd punch their loving teeth in. I'm dead serious about that too. I *continuously* encounter django users treating newbies like this online , and its pissing me off. I wouldn't dare treat a beginner like that. e: For reference I'm tracking down "'RegexURLResolver' object is not callable" from a fairly dated django project I found called django-project-management. Poking around, I'm thinking this is fairly aged bit-rotted code, might not be worth trying to fix. duck monster fucked around with this message at 00:32 on Mar 5, 2012 |
# ? Mar 5, 2012 00:24 |
|
duck monster posted:No heres a reason to hate django Having said that, angry, arrogant manbabies were basically my experience with asking for programming help anywhere online, and I won't hesitate to recommend a relevant IRC channel over Stack Overflow, as long as it's something that doesn't require some time and effort to fix. I don't know if the channels better or worse than any of the other framework channels.
|
# ? Mar 5, 2012 00:45 |
|
duck monster posted:No heres a reason to hate django apollo13 is just a particularly grumpy guy. Most folks in the #django channel are very helpful as long as you aren't dense. I've seen them spend hours helping someone who is just flat out not listening to them.
|
# ? Mar 5, 2012 12:34 |
|
My experiences in #django have been mostly enjoyable. Sometimes you have to fight to convince them that the problem you're having in some exceptional case that isn't part of the docs, but I guess that's fair. (Have you met the guys in #java?)
|
# ? Mar 5, 2012 15:34 |
|
So this is making me pull my hair out, even though it's probably a simple fix. I have a command-line script that I wrote to take data from an export (CSV files), create models for each record, and save them as a way of importing the data to my new Django project. I have this at the top of the script to set up the Django environment, which I've used in other scripts with no problems: code:
On the next line, I import my models, which works fine: code:
code:
What's more, further on down the script I have the Department records imported from the CSV file, created as Department objects (which Django is saying doesn't exist), and they all save successfully. But when I try to make new Department objects after they're imported, I get the same ImportError as above. I can literally do this: code:
|
# ? Mar 5, 2012 20:02 |
|
EDIT: Ignore this post. I am dumb and gay.
DICTATOR OF FUNK fucked around with this message at 16:14 on Mar 6, 2012 |
# ? Mar 6, 2012 16:12 |
|
geera posted:So this is making me pull my hair out, even though it's probably a simple fix. Care to post your models.py? I wonder if it's something in a post_delete signal handler or something. Also to the guy above, let's keep the homophobia out of this thread. In fact you should probably just keep your mouth shut altogether.
|
# ? Mar 6, 2012 16:31 |
|
Lamacq posted:Care to post your models.py? I wonder if it's something in a post_delete signal handler or something.
|
# ? Mar 6, 2012 19:01 |
|
geera posted:I rewrote the script to add it as a custom manage.py command and now it's working, so I'm thinking the problem was related to how the environment was being set up. I asked in #django on freenode and it blew their minds, too, so that's where the suggestion to make it a command came from. Yeah I was actually wondering why you hadn't just written it as a management command (although a valid answer to that would have been, "b/c the syntax for management commands sucks.") Anyway glad you got it working.
|
# ? Mar 6, 2012 19:15 |
|
I've been meaning to educate myself further on using Fabric, virtualenv+pip and BitBucket to handle my Django app deployments. Seems most of the blog posts I can find on google are from 2009-10 and I was wondering if it was still an acceptable deployment method or if it's deprecated now?
|
# ? Mar 6, 2012 21:39 |
|
It's very much still the deployment method du-jour. At least, if you're not using Heroku, gondor, epio etc (I think they have their own CLI interfaces?).
|
# ? Mar 6, 2012 23:03 |
|
Yay posted:It's very much still the deployment method du-jour. At least, if you're not using Heroku, gondor, epio etc (I think they have their own CLI interfaces?). Woa, how cool is epio? Thanks for bringing that to my attention.
|
# ? Mar 6, 2012 23:21 |
|
Hanpan posted:Woa, how cool is epio? Thanks for bringing that to my attention. PaaS are pretty awesome.
|
# ? Mar 6, 2012 23:30 |
|
|
# ? Jun 1, 2024 00:32 |
|
I've been using Heroku. Very cool service.
|
# ? Mar 7, 2012 05:25 |