Files
2012-02-21 01:15:00 -05:00

1 line
5.2 KiB
JSON

[{"user_id": 6396, "stars": [], "topic_id": 19445, "date_created": 1302799327.0818851, "message": "Basically, like a lot of people, I use runserver to serve static assets while developing.", "group_id": 81, "id": 687121}, {"user_id": 6396, "stars": [], "topic_id": 19445, "date_created": 1302799385.35918, "message": "So this brings my question: how on earth do I see 404 pages with static media served when I have to have DEBUG = False to see the actual 404 page?", "group_id": 81, "id": 687135}, {"user_id": 6396, "stars": [], "topic_id": 19445, "date_created": 1302799448.632627, "message": "Any nice tips?", "group_id": 81, "id": 687152}, {"user_id": 6396, "stars": [], "topic_id": 19445, "date_created": 1302799344.9811089, "message": "Before 1.3, this involved some extra stuff in urls.py", "group_id": 81, "id": 687125}, {"user_id": 6396, "stars": [], "topic_id": 19445, "date_created": 1302799443.4092131, "message": "Given that with DEBUG = True you just get the yellow \"url did not match\" debug page..", "group_id": 81, "id": 687151}, {"user_id": 6396, "stars": [], "topic_id": 19445, "date_created": 1302799356.151042, "message": "but now runserver does it by default, *as long as DEBUG = True*", "group_id": 81, "id": 687127}, {"user_id": 6396, "stars": [], "topic_id": 19445, "date_created": 1302799702.76002, "message": "I'm obviously looking for things other than creating a specific test URL for the page, which is what I've had to do.", "group_id": 81, "id": 687191}, {"user_id": 13912, "stars": [{"date_created": 1302860380.6908801, "user_id": 6396}], "topic_id": 19445, "date_created": 1302801820.456533, "message": "or you can simply use this http://docs.djangoproject.com/en/dev/ref/contrib/staticfiles/#django-admin-option---insecure", "group_id": 81, "id": 687564}, {"user_id": 13912, "stars": [{"date_created": 1302806116.1152699, "user_id": 4581}], "topic_id": 19445, "date_created": 1302801627.585001, "message": "just from the top of my mind, you could run collectstatic (-i) and add the folder where they are collected in the urlconf to be served by the debugserver (like you did before 1.3), then remove it later", "group_id": 81, "id": 687536}, {"user_id": 13912, "stars": [], "topic_id": 19445, "date_created": 1302801755.567414, "message": "or you could add aditional middleware somewhere at the top of the middleware stack that catches the 404 error and renders the actual 404 template regardless of the DEBUG setting", "group_id": 81, "id": 687555}, {"user_id": 4581, "stars": [], "topic_id": 19445, "date_created": 1302806283.6407959, "message": "I'll add to @Vasil's suggestion on using collecstatic - I would also set debug=False and log any errors somewhere else. This'll let you play with something that's closer to what you'd have in production without introducing any middleware that you'd otherwise (probably) not want.", "group_id": 81, "id": 688454}, {"user_id": 4581, "stars": [], "topic_id": 19445, "date_created": 1302806408.53706, "message": "In the past, I've also implemented any logic for a 404 page as templatetag, which you could conceivably drop into any template.", "group_id": 81, "id": 688478}, {"user_id": 13912, "stars": [], "topic_id": 19445, "date_created": 1302811444.8123569, "message": "@bkmontgomery I think the third solution using the --insecure option to runserver is the easiest for his actual problem, the reason it was put there is probably something like that, testing the site with DEBUG=False for a bit while developing", "group_id": 81, "id": 689715}, {"user_id": 4077, "stars": [], "topic_id": 19445, "date_created": 1302837907.8427751, "message": "Is there some reason you can't just disable DEBUG for testing your 404 pages?", "group_id": 81, "id": 694951}, {"user_id": 4858, "stars": [], "topic_id": 19445, "date_created": 1302843231.1811781, "message": "and then open /404 and /500 pages to test error pages", "group_id": 81, "id": 695873}, {"user_id": 4858, "stars": [], "topic_id": 19445, "date_created": 1302843207.6367159, "message": "you can use this in urls.py:", "group_id": 81, "id": 695869}, {"user_id": 4858, "stars": [{"date_created": 1302883369.4051681, "user_id": 13339}], "topic_id": 19445, "date_created": 1302843223.3770809, "message": "if settings.DEBUG:\n urlpatterns += patterns('',\n url(r'^404$', TemplateView.as_view(template_name='404.html')),\n url(r'^500$', TemplateView.as_view(template_name='500.html')),\n)", "group_id": 81, "id": 695872}, {"user_id": 6396, "stars": [], "topic_id": 19445, "date_created": 1302860474.167469, "message": "@vasil That --insecure flag to runserver was exactly what I was looking for; fixes my issues perfectly with no extra code. Perfect, cheers.", "group_id": 81, "id": 698744}, {"user_id": 6396, "stars": [], "topic_id": 19445, "date_created": 1302860585.6424389, "message": "@bmelton Yes, because once you disable DEBUG, the runserver in 1.3 will stop serving your static by default and hence the page layout gets screwed. The --insecure flag (@Vasil) to runserver was exactly what I was looking for (it temporarily ignores that serving static under DEBUG = False is bad).", "group_id": 81, "id": 698758}, {"user_id": 4077, "stars": [], "topic_id": 19445, "date_created": 1302899696.121156, "message": "Apologies, you're exactly right. I don't know how I glossed over that.", "group_id": 81, "id": 704994}]