Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Post
  • Reply
MonkeyMaker
May 22, 2006

What's your poison, sir?
If you feel like you can afford it, Djangocon US has extended their CFP to June 25th.

I still think the price is ridiculous.

Adbot
ADBOT LOVES YOU

Thermopyle
Jul 1, 2003

...the stupid are cocksure while the intelligent are full of doubt. —Bertrand Russell

MonkeyMaker posted:

If you feel like you can afford it, Djangocon US has extended their CFP to June 25th.

I still think the price is ridiculous.

I was recently thinking I should start engaging with the programming community IRL more (at all) and a con seems like a good way to do that, and since I've been doing a lot of Django recently, Djangocon seems like a good way to start.

Oh wait, 900 dollars.

MonkeyMaker
May 22, 2006

What's your poison, sir?

Thermopyle posted:

I was recently thinking I should start engaging with the programming community IRL more (at all) and a con seems like a good way to do that, and since I've been doing a lot of Django recently, Djangocon seems like a good way to start.

Oh wait, 900 dollars.

The community is great. And it's a good conf, but it's not $900 worth of conf.

Go to PyCon. You won't be disappointed.

duck monster
Dec 15, 2004

Thermopyle posted:

I was recently thinking I should start engaging with the programming community IRL more (at all) and a con seems like a good way to do that, and since I've been doing a lot of Django recently, Djangocon seems like a good way to start.

Oh wait, 900 dollars.

Do you have any community projects or whatever your heavily involved with. A lot of these cons you can get sponsored to visit , sometimes even including plane fares if you sit on a panel or whatever. A mate of mines a Debian maintainer and hes been to every debian conference the past decade, and had it paid for every single time. Plus the various LUG and other conferences, all paid for.

Heck, just contact them and say you can't afford it and offer to help out, like sit on a door for an afternoon or something. Usually these conferences are loving hard work and they'll take *ANY* help they can get.

Conferences are a great excuse to get lots of travel in. I used to conference hop doing environmentalist conferences (I was pretty involved in forest rescue activism in the 90s) and it was really one of the few things that got me genuinely travelling, plus since I'd always meet people in the target city, I'd always have a set of new friends to show me around and let me camp at their house.

duck monster fucked around with this message at 00:12 on Jun 21, 2013

MonkeyMaker
May 22, 2006

What's your poison, sir?

duck monster posted:

Do you have any community projects or whatever your heavily involved with. A lot of these cons you can get sponsored to visit , sometimes even including plane fares if you sit on a panel or whatever. A mate of mines a Debian maintainer and hes been to every debian conference the past decade, and had it paid for every single time. Plus the various LUG and other conferences, all paid for.

Heck, just contact them and say you can't afford it and offer to help out, like sit on a door for an afternoon or something. Usually these conferences are loving hard work and they'll take *ANY* help they can get.

Conferences are a great excuse to get lots of travel in. I used to conference hop doing environmentalist conferences (I was pretty involved in forest rescue activism in the 90s) and it was really one of the few things that got me genuinely travelling, plus since I'd always meet people in the target city, I'd always have a set of new friends to show me around and let me camp at their house.

Yeah...PyCon is that way. DjangoCon US really isn't.

duck monster
Dec 15, 2004

MonkeyMaker posted:

Yeah...PyCon is that way. DjangoCon US really isn't.

Bummer :(

edit: There is a delegate sponsorship program, but it looks like theres only $10K available all up for it which probably is for people doing talks or something.

edit2: It might not be so bad: http://www.djangocon.us/faqs/ The cheapest tickets are $760 for individual tickets and it might be possible to wrangle a few hundred in sponsorship to bring it down to a sane price, but I imagine you'd need to be involved pretty heavily in one of the notable community projects or something.

They really need to go to Google or something and get them to throw some googlebux at making this poo poo cheaper since Google push django pretty heavily for its app engine thingo.

duck monster fucked around with this message at 02:22 on Jun 21, 2013

Chron
Dec 24, 2000

Forum Absurdist
Apparently, I don't get how models work in django. I'm trying to learn django, and to do so I'm making a simple CRUD app that gives me the ability to enter in beers that I've drunk and rated. When I get data from a model, one of the foreign keys I'm using is being returned as a model instead of a string that I can render to HTML.

Here are my models:
code:
class Beer(models.Model):
	name = models.CharField(max_length = 200)
	style = models.CharField(max_length = 200)
	brewery = models.ForeignKey('Brewery')
	date_tasted = models.DateField()
	rating = models.IntegerField()
	notes = models.TextField()

	def __unicode__(self):
		print self.name

class Brewery(models.Model):
	name = models.CharField(max_length = 200)

	def __unicode__(self):
		print self.name

Here's my relevant view that does not work. It's because Beer.brewery is returning a model instead of a string like Beer.name. I'm using function based views right now as they make more sense to me, but I'll switch to CBVs when I get the easy stuff down.

The error is "TypeError at /beerratings/detail/1/ coercing to Unicode: need string or buffer, NoneType found"

code:
def beer_detail_view(request, beer_id):
	beer_detail = get_object_or_404(Beer, pk=beer_id)

	return render_to_response('beer_detail.html', {'beer': beer_detail })
Here's my work around. This does work as intended.

code:
	 return render_to_response('beer_detail.html', {'beer': {
		'name': beer_detail.name,
		'style': beer_detail.style,
		'brewery': beer_detail.brewery.name,
		'date_tasted': beer_detail.date_tasted,
		'rating': beer_detail.rating,
		'notes': beer_detail.notes
		}})
First - Is the work around the correct way to do this using FBVs? I just want Beer.brewery to return a string so I can throw it at my template.
Second - Is this even the best way to go about writing this kind of thing?

ephphatha
Dec 18, 2009




What's the contents of your beerdetail.html template?

Baby Nanny
Jan 4, 2007
ftw m8.

Chron posted:

Apparently, I don't get how models work in django. I'm trying to learn django, and to do so I'm making a simple CRUD app that gives me the ability to enter in beers that I've drunk and rated. When I get data from a model, one of the foreign keys I'm using is being returned as a model instead of a string that I can render to HTML.

Here are my models:
code:

class Beer(models.Model):
	name = models.CharField(max_length = 200)
	style = models.CharField(max_length = 200)
	brewery = models.ForeignKey('Brewery')
	date_tasted = models.DateField()
	rating = models.IntegerField()
	notes = models.TextField()

	def __unicode__(self):
		print self.name

class Brewery(models.Model):
	name = models.CharField(max_length = 200)

	def __unicode__(self):
		print self.name


Here's my relevant view that does not work. It's because Beer.brewery is returning a model instead of a string like Beer.name. I'm using function based views right now as they make more sense to me, but I'll switch to CBVs when I get the easy stuff down.

The error is "TypeError at /beerratings/detail/1/ coercing to Unicode: need string or buffer, NoneType found"

code:

def beer_detail_view(request, beer_id):
	beer_detail = get_object_or_404(Beer, pk=beer_id)

	return render_to_response('beer_detail.html', {'beer': beer_detail })

Here's my work around. This does work as intended.

code:

	 return render_to_response('beer_detail.html', {'beer': {
		'name': beer_detail.name,
		'style': beer_detail.style,
		'brewery': beer_detail.brewery.name,
		'date_tasted': beer_detail.date_tasted,
		'rating': beer_detail.rating,
		'notes': beer_detail.notes
		}})

First - Is the work around the correct way to do this using FBVs? I just want Beer.brewery to return a string so I can throw it at my template.
Second - Is this even the best way to go about writing this kind of thing?

The first way you had it was right. In your template you can access the data using the same .'s that you did in your not so right workaround. {{ beer.brewery.name }} for example will put the beers name in your rendered HTML

Lumpy
Apr 26, 2002

La! La! La! Laaaa!



College Slice

Chron posted:

Second - Is this even the best way to go about writing this kind of thing?

Unless there's a compelling reason not to, you should probably be using Class Based Views for this. I *think* (I'm still somewhat of a newbie to Django, so don't trust my code verbatim) you would jsut do this:

Python code:
class BeerDetail(DetailView):
    model = Beer
    template_name = "beerDetail.html"
And then as others have mentioned, you just use {{ beer.brewery.name }} to display the info

avidal
May 19, 2006
bawl-some

Chron posted:

Apparently, I don't get how models work in django. I'm trying to learn django, and to do so I'm making a simple CRUD app that gives me the ability to enter in beers that I've drunk and rated. When I get data from a model, one of the foreign keys I'm using is being returned as a model instead of a string that I can render to HTML.

Here are my models:
code:
class Beer(models.Model):
	name = models.CharField(max_length = 200)
	style = models.CharField(max_length = 200)
	brewery = models.ForeignKey('Brewery')
	date_tasted = models.DateField()
	rating = models.IntegerField()
	notes = models.TextField()

	def __unicode__(self):
		print self.name

class Brewery(models.Model):
	name = models.CharField(max_length = 200)

	def __unicode__(self):
		print self.name

Here's my relevant view that does not work. It's because Beer.brewery is returning a model instead of a string like Beer.name. I'm using function based views right now as they make more sense to me, but I'll switch to CBVs when I get the easy stuff down.

The error is "TypeError at /beerratings/detail/1/ coercing to Unicode: need string or buffer, NoneType found"

code:
def beer_detail_view(request, beer_id):
	beer_detail = get_object_or_404(Beer, pk=beer_id)

	return render_to_response('beer_detail.html', {'beer': beer_detail })
Here's my work around. This does work as intended.

code:
	 return render_to_response('beer_detail.html', {'beer': {
		'name': beer_detail.name,
		'style': beer_detail.style,
		'brewery': beer_detail.brewery.name,
		'date_tasted': beer_detail.date_tasted,
		'rating': beer_detail.rating,
		'notes': beer_detail.notes
		}})
First - Is the work around the correct way to do this using FBVs? I just want Beer.brewery to return a string so I can throw it at my template.
Second - Is this even the best way to go about writing this kind of thing?

I believe the nature of your problem is that the beer you are rendering has a brewery which does not have a name. So, when Django is rendering the template, it's getting the unicode representation of the `Brewery` object, which calls Brewery.__unicode__, which returns self.name, however if self.name is None, then you can get that exception (iirc).

As other's have said, your original approach is the correct way (don't turn it into a dict yourself); the problem is in your data.

MonkeyMaker
May 22, 2006

What's your poison, sir?

Chron posted:

code:
class Beer(models.Model):
	name = models.CharField(max_length = 200)
	style = models.CharField(max_length = 200)
	brewery = models.ForeignKey('Brewery')
	date_tasted = models.DateField()
	rating = models.IntegerField()
	notes = models.TextField()

	def __unicode__(self):
		print self.name

class Brewery(models.Model):
	name = models.CharField(max_length = 200)

	def __unicode__(self):
		print self.name


First off, methods should generally `return` things, not `print` them. That'll let you do `{{ beer.brewery }}` and it'll just print out the brewery's name.

As for doing it as a class-based view:

code:
from django.views.generic import DetailView

from .models import Beer

class BeerDetailView(DetailView):
    model = Beer
    template_name = "beer/beer_detail.html"
and urls.py:

code:
from beers.views import BeerDetailView

urlpatterns = patterns('',
...
url(r'^beer/(?P<pk>\d+)/$', BeerDetailView.as_view(), name="beer_detail"),
...
)
Do whatever you need in beer_detail.html and you should be good to go. There are patterns in what I've just shown you that I wouldn't personally do (I tend to have a urls.py per project with namespaced urls, etc), but this should be enough to get you going in the right direction.

Chron
Dec 24, 2000

Forum Absurdist
You all rock.

Adding beer.brewery.name didn't, at first, work, because I was printing the string to the command line, but not returning it. Changing the print to a return, as per MonkeyMoney, fixed everything. Thanks.

The March Hare
Oct 15, 2006

Je rêve d'un
Wayne's World 3
Buglord
I'm making a little web game in Django and I've hit a small snag, looking for some advice. The problem is that, as I have it currently built up, the /fight url loads up the Fight view and lets you pick a monster to fight. When you submit that form, it sends a post request to /fight and the Fight view recognizes that, does some math, and stores stuff like "You hit a dragon for 1,452 damage!" in some variables and passes them on as context using render_to_response. The /fight template then pulls those out of the context and displays them on that same page. The issue with this method is that refreshing the page resubmits the form, which kinda donks some stuff up.

From what I've been able to figure out from google, passing the data around in the user's session and just redirecting to the /fight view after the form posts using httpresponseredirect is an option. Are there other/better options here? Also, are there any potential pitfalls with using sessions for this?

Yay
Aug 4, 2007
From what you've described, it sounds like you need to implement the time-honoured POST/Redirect/GET. Essentially, on a successful form submission, perform a redirect (301/302), back to the same URL in this case. This mitigates the refresh=resubmit issue, but not the potential for double-submits, for which you'll probably want to employ some JavaScript.

MonkeyMaker
May 22, 2006

What's your poison, sir?

Yay posted:

From what you've described, it sounds like you need to implement the time-honoured POST/Redirect/GET. Essentially, on a successful form submission, perform a redirect (301/302), back to the same URL in this case. This mitigates the refresh=resubmit issue, but not the potential for double-submits, for which you'll probably want to employ some JavaScript.

POSTs should almost never render anything. They should, 99.99999% of the time, return a redirect, as Yay said. This is true in most places, not just Django.

The March Hare
Oct 15, 2006

Je rêve d'un
Wayne's World 3
Buglord

MonkeyMaker posted:

POSTs should almost never render anything. They should, 99.99999% of the time, return a redirect, as Yay said. This is true in most places, not just Django.

Right, I'm just now discovering this. So what is the method for this in Django assuming I want to maintain state here? I can post the code handling things once I get home later tonight if that would help, but my understanding is using an HttpResponseRedirect will shoot dudes through after the form submit, but then I will have to resort to storing information in the user session to display the result of the form submit (the log of combat etc.,) right? Or am I missing something here.

avidal
May 19, 2006
bawl-some

The March Hare posted:

Right, I'm just now discovering this. So what is the method for this in Django assuming I want to maintain state here? I can post the code handling things once I get home later tonight if that would help, but my understanding is using an HttpResponseRedirect will shoot dudes through after the form submit, but then I will have to resort to storing information in the user session to display the result of the form submit (the log of combat etc.,) right? Or am I missing something here.

That's right. You'll need to store the log/combat message elsewhere. There are a few ideas, you could use django's messaging framework to have standard messages, or (since your combat messages might not fit that mold), you can have a model that represents activity, and show the user the last message from the activity log on the page.

MonkeyMaker
May 22, 2006

What's your poison, sir?

The March Hare posted:

Right, I'm just now discovering this. So what is the method for this in Django assuming I want to maintain state here? I can post the code handling things once I get home later tonight if that would help, but my understanding is using an HttpResponseRedirect will shoot dudes through after the form submit, but then I will have to resort to storing information in the user session to display the result of the form submit (the log of combat etc.,) right? Or am I missing something here.

Depends on how you want to have the information. If you need a battle log, I'd create a new model instance for who did how much damage to who (<player_instance> hit <enemy_instance> for <hit_points_value>) and then you can just fetch that out of the database for the new page and show it. If you don't need the battle log, Django provides django.contrib.messages which should be fine. It works like flash messages in Rails, where the data only persists for one more page load.

NtotheTC
Dec 31, 2007


I find myself in an odd position, I've been working with Django for a year but still know very little about setting up web servers. I recently got a new job and am the sole developer on an existing website, and am feeling a little apprehensive because there is no-one for me to learn from to fill in the gaps in my knowledge. Is there a definitive (or at least widely accepted) "Start Here" place for getting more familiar with setting up and deploying to web servers?

To clarify, the previous developer left before I joined, so I didn't get the opportunity to talk to him about the site's setup. He left notes, though they are not really extensive. I guess I'm looking for a way to familiarise myself with everything as quickly as possible.

NtotheTC fucked around with this message at 22:34 on Jul 2, 2013

duck monster
Dec 15, 2004

NtotheTC posted:

I find myself in an odd position, I've been working with Django for a year but still know very little about setting up web servers. I recently got a new job and am the sole developer on an existing website, and am feeling a little apprehensive because there is no-one for me to learn from to fill in the gaps in my knowledge. Is there a definitive (or at least widely accepted) "Start Here" place for getting more familiar with setting up and deploying to web servers?

To clarify, the previous developer left before I joined, so I didn't get the opportunity to talk to him about the site's setup. He left notes, though they are not really extensive. I guess I'm looking for a way to familiarise myself with everything as quickly as possible.

Get a debian (or red-hat/centos I guess) linux box and learn the gently caress out of the command line via books.

Seriously. It'll make you a better IT person in every conceivable way.

Like, just set it up as XBMC thing for your TV set to keep it girlfriend justifiable and use it to learn how to set up apache, mysql, postgres, memchache/redis/whateer, and a mail server, samba (for inhouse machines only!) and various business useful web-apps. Know how to deploy java and java apps even if you sanely never intend to.

Its handy to know how to work crontab, and its handy to know how to script up poo poo using pythonor perl if your a oval office.

duck monster fucked around with this message at 04:03 on Jul 4, 2013

etcetera08
Sep 11, 2008

NtotheTC posted:

I find myself in an odd position, I've been working with Django for a year but still know very little about setting up web servers. I recently got a new job and am the sole developer on an existing website, and am feeling a little apprehensive because there is no-one for me to learn from to fill in the gaps in my knowledge. Is there a definitive (or at least widely accepted) "Start Here" place for getting more familiar with setting up and deploying to web servers?

To clarify, the previous developer left before I joined, so I didn't get the opportunity to talk to him about the site's setup. He left notes, though they are not really extensive. I guess I'm looking for a way to familiarise myself with everything as quickly as possible.

That's kind of a broad question/topic, but if you know the stack being used it will be much easier to learn about and you can practice deploying your own dummy apps with the same stack.

Other than that, duck monster is pretty on target in that you'll have to know a lot of generalities about *nix platforms if you want to be effective at troubleshooting, etc.

Maluco Marinero
Jan 18, 2001

Damn that's a
fine elephant.
If you wanna familiarise yourself with setups, practice replicating them on a Virtual Environment, using something like vagrantup.com makes it dead simple to set up and tear down, and is an excellent test bed for scripts and config management too so you can get the hang of automating the boring bits (nearly all of it).

MonkeyMaker
May 22, 2006

What's your poison, sir?
All you *really* need to know how to set up is: postgresql, nginx, and either uWSGI or gunicorn. Then learn how to harden the server enough for 99% of cases and you're good enough.

Pythagoras a trois
Feb 19, 2004

I have a lot of points to make and I will make them later.
Deploying a django webapp on Dreamhost. Good idea, or bad idea?

I'm confronted with a deployment coming up soon, and I can pussyfoot around it all I want but eventually I need to either poo poo or get off the pot on the free Dreamhosting/paid Heroku decision.

MonkeyMaker
May 22, 2006

What's your poison, sir?

Cheekio posted:

Deploying a django webapp on Dreamhost. Good idea, or bad idea?

I'm confronted with a deployment coming up soon, and I can pussyfoot around it all I want but eventually I need to either poo poo or get off the pot on the free Dreamhosting/paid Heroku decision.

Bad idea. Heroku is free for single processes.

Lumpy
Apr 26, 2002

La! La! La! Laaaa!



College Slice

Cheekio posted:

Deploying a django webapp on Dreamhost. Good idea, or bad idea?

I'm confronted with a deployment coming up soon, and I can pussyfoot around it all I want but eventually I need to either poo poo or get off the pot on the free Dreamhosting/paid Heroku decision.

If it's a toy "just for me I don't care if its slow as poo poo" and you already host there, not a terrible idea. But yeah, if its a site that others will look at, no Dreamhost for Django.

Thermopyle
Jul 1, 2003

...the stupid are cocksure while the intelligent are full of doubt. —Bertrand Russell

MonkeyMaker posted:

Bad idea. Heroku is free for single processes.

Also, if you need a second process that doesn't run too often, this works on the free tier:

In Procfile:
code:
web: honcho -f ProcfileHoncho start
In ProcfileHoncho:
code:
web: gunicorn the_name_you_use.wsgi
celery: python manage.py celery worker -B --loglevel=info

Kumquat
Oct 8, 2010
Has anyone had a chance to look through Test Driven Web Development with Python and have any thoughts on it? I've been meaning to check it out but I just haven't had the time.

Thermopyle
Jul 1, 2003

...the stupid are cocksure while the intelligent are full of doubt. —Bertrand Russell

Kumquat posted:

Has anyone had a chance to look through Test Driven Web Development with Python and have any thoughts on it? I've been meaning to check it out but I just haven't had the time.

I'm reading throught it right now since you mention it. My only issue with it so far is that it calls Dive into Python excellent.

MonkeyMaker
May 22, 2006

What's your poison, sir?

Thermopyle posted:

I'm reading throught it right now since you mention it. My only issue with it so far is that it calls Dive into Python excellent.

"Dive Into Python" was good for the time. It just fell out of date really quickly.

fletcher
Jun 27, 2003

ken park is my favorite movie

Cybernetic Crumb
I'm attempting to add the django-rest-framework SearchFilter with an existing Django project.

settings.py:
code:
REST_FRAMEWORK = {
    'DEFAULT_FILTER_BACKENDS': ('rest_framework.filters.SearchFilter','rest_framework.filters.OrderingFilter')
}
I created my Serializer & ViewSet:
code:
class EmployeeSerializer(serializers.ModelSerializer):
    class Meta:
        model = models.Employee
        fields = ('id', 'first_name', 'last_name')

class EmployeeViewSet(viewsets.ModelViewSet):
    model = models.Employee
    serializer_class = EmployeeSerializer
    search_fields = ('last_name')
But when I hit the URL /api/employees?search=smith I get an error message like this:

quote:

FieldError at /api/employees/

Cannot resolve keyword u'l' into field. Choices are: id, first_name, last_name, ..., etc

fletcher
Jun 27, 2003

ken park is my favorite movie

Cybernetic Crumb
Finally got PyCharm setup so I could step through it. It didn't like search_fields being a str...I added a trailing comma to make it a tuple and now it works. Hooray!

code:
class EmployeeViewSet(viewsets.ModelViewSet):
    model = models.Employee
    serializer_class = EmployeeSerializer
    search_fields = ('last_name',)

Pythagoras a trois
Feb 19, 2004

I have a lot of points to make and I will make them later.
Implementing Ajax in Django- are there pitfalls or huge security holes I need to watch out for? The data isn't sensitive going in either direction, but I figure it's always safe to ask.

Thermopyle
Jul 1, 2003

...the stupid are cocksure while the intelligent are full of doubt. —Bertrand Russell

Cheekio posted:

Implementing Ajax in Django- are there pitfalls or huge security holes I need to watch out for? The data isn't sensitive going in either direction, but I figure it's always safe to ask.

There's nothing specific about Django that would make Ajax more or less safe.

fletcher
Jun 27, 2003

ken park is my favorite movie

Cybernetic Crumb
Any of you guys used django-pipeline before?

I tried to follow these instructions but I can't seem to get it to work right.

Installed the css & js compressor in my virtualenv:
code:
pip install cssmin
pip install slimit
Added it to my INSTALLED_APPS:
code:
INSTALLED_APPS = (
...
    'pipeline',
...
)
Added some configuration parameters:
code:
STATIC_ROOT = '/home/fletcher/static-test/'

STATICFILES_STORAGE = 'pipeline.storage.PipelineCachedStorage'

PIPELINE_CSS_COMPRESSOR = 'pipeline.compressors.cssmin.CSSMinCompressor'

PIPELINE_CSSMIN_BINARY = 'cssmin'

PIPELINE_JS_COMPRESSOR = 'pipeline.compressors.slimit.SlimItCompressor'

PIPELINE_CSS = {
    'myapp': {
        'source_filenames': (
            'css/file1.css',
            'css/file2.css',
        ),
        'output_filename': 'combined.min.css',
    },
}

PIPELINE_JS = {
    'myapp': {
        'source_filenames': (
            'js/file1.js',
            'js/fil2.js',
        ),
        'output_filename': 'combined.min.js',
    }
}
Then I run:
code:
python manage.py collectstatic
And in the output I can see it copying all my files and doing the post-processing:
code:
139 static files copied, 141 post-processed.
I go to check the contents of /home/fletcher/static-test/ and I see a couple folders for the static resources from each app, but combined.min.css is completely empty, and combined.min.js contains only this:
code:
(function(){}).call(this);
Added the following to my base template:
code:
{% load compressed %}
{% compressed_css 'myapp' %}
{% compressed_js 'myapp' %}
But no static resources are loaded. Don't see anything in the resulting html actually, not even links to static resources that result in 404s. This should still work even though I'm using manage.py runserver for dev work, right? From my understanding it should just be loading the unminified versions since I have DEBUG = True.

fletcher
Jun 27, 2003

ken park is my favorite movie

Cybernetic Crumb
Bah! Finally figured it out! I needed to have the source_filenames start with myapp/ like this:

code:
PIPELINE_CSS = {
    'myapp': {
        'source_filenames': (
            'myapp/css/file1.css',
            'myapp/css/file2.css',
        ),
        'output_filename': 'combined.min.css',
    },
}

deimos
Nov 30, 2006

Forget it man this bat is whack, it's got poobrain!
Pydanny just tweeted this and I thought I'd share with you guys, it's a pretty great resource for CBVs.

Thermopyle
Jul 1, 2003

...the stupid are cocksure while the intelligent are full of doubt. —Bertrand Russell

deimos posted:

Pydanny just tweeted this and I thought I'd share with you guys, it's a pretty great resource for CBVs.

Yeah, I've been using this ever since I decided to wrap my mind around CBV's and it makes dealing with them so much easier.

Adbot
ADBOT LOVES YOU

NtotheTC
Dec 31, 2007


I'd quite like to do some open-source contributing centered around Django. Is there some sort of list or resource to find a project that is looking for contributors?

  • 1
  • 2
  • 3
  • 4
  • 5
  • Post
  • Reply