The Beer Stash - Minor Styling Changes and Pretty Beer Stash Names

The more I plan on relaxing and playing Diablo, the more coding I end up doing. I guess there are worse things in life. Tonight brings a fix that’s been bothering me since I hacked it together - the ridiculous restriction on Beer Stash names. You could only use letters, numbers and dashes. Ugh. Sorry. Now you can use any name you want, and even better, you can edit the names of your previously created Beer Stashes

Note: In the first picture, the icon to the left of the delete button is the edit button for that stash.

Also you’ll see a little styling change in the first picture. There will be small changes like that here and there until I accidentally find one that looks good.

The Beer Stash - A Fresh New Theme, User Profile and Registration

I feel like I’m getting close to opening the site for public registration. This is excited but really, then the hard part begins. How do I get YOU to use my site? We’ll cross that road when we get to it. For now, I got some updates for you:

First, and the most visible update, a new theme for the site. No, I didn’t create it, but I did it get premade from Bootswatch. I think it works but I think all dark themes work.

Keen obverses will notice the homepage has slightly been updated (outside of the theme change). There are now direct links for registering and logging in. Registration is behing handled by django-registration.

The registration screen:

But no love for you… yet :)

And the newly fixed up login screen:

Another major component to releasing into the public was missing landing pages for each user, which are now are available at the url http://thebeerstash.com/users/. Not that this is a very rough first go at it. Just to have something there. More will be done to it as time goes on.

I’d say “keen observers” for this part but since no one really used this feature, I doubt anyone will notice it will be gone. I’ve removed the notes functionality. Like I said, no one used it meaning it wasn’t useful. It will probably be reimplemented later once I get more feed back on what would be useful.

Caching Django's Sitemap

One of the problems I ran into early with The Beer Stash was Google not indexing the site because /robots.txt was 503-ing. Researching solutions lead me to django-robots which lead me back to Django’s Sitemaps. The sitemaps do not seem to be cached which could be a bad thing. I think. I am throwing Knuth’s caution to the wind and optimizing from now. This is a little view I wrote that caches the Sitemap for 15 minutes.

Cache the generated sitemap.xml for 15 minutes
1
2
3
4
5
6
7
from django.views.decorators.cache import cache_page
....
@cache_page(60 * 15) # cache_page(seconds)
def sitemap(request, sitemaps, section=None,
template_name='sitemap.xml', mimetype='application/xml'):

from django.contrib.sitemaps.views import sitemap
return sitemap(request, sitemaps, section, template_name, mimetype)

I get the feeling that this may not be the best way, but it’s the best I could come up with for a quick solution. I am using the Filesystem cache. Nothing else is being cached atm.