django packages list

15
Django packages Michele Mattioni @mattions

Upload: michele-mattioni

Post on 16-Jul-2015

526 views

Category:

Software


1 download

TRANSCRIPT

Page 1: Django packages list

Django packages

Michele Mattioni@mattions

Page 2: Django packages list

Three main categories

● Serving static files● Users registration● Settings splitting

Page 3: Django packages list

Serving Static

● Ready to deploy● collectstatic● Launching gunicorn

Page 4: Django packages list
Page 5: Django packages list

You could read the docs...

● Django does not serve static.● You have to run collect static● You need to server them via nginx or apache

Page 6: Django packages list

For an easy solution

● Use WhiteNoise!

https://pypi.python.org/pypi/whitenoise

Page 7: Django packages list

Static files: the struggle

Writing time● SASS● LESS● CooffeScript● Javascript

Serving time● One file for CSS● One file for JS

Page 8: Django packages list

Use django-pipeline

https://django-pipeline.readthedocs.org● Automatically Compiles SASS and LESS in

CSS during debug time● Minification and concatanation happens at

collectstatic time.

Page 9: Django packages list

Let's go to the User Registration

Page 10: Django packages list

User registration

● Starting a django project with User registration already embedded?

https://github.com/pinax/pinax-project-account

django-admin.py startproject --template=https://github.com/pinax/pinax-project-account/zipball/master <project_name>

Page 11: Django packages list

Goodies

● Sign In/Log in● Email with link to activate user● Password reset● Account Deletion● Based on bootstrap3 forms

Page 12: Django packages list

Settings split

settings.py → settings/__init__.py

settings/common.py

settings/dev.py

settings/prod.py

Pick the proper settings settings:● DJANGO_MODULE_SETTINGS=myproject.settings.dev

● DJANGO_MODULE_SETTINGS=myproject.settings.prod

Page 13: Django packages list

How to combine settings

# dev.py

from common import *

DEBUG = True

# prod.py

from common import *

DEBUG = False

Page 14: Django packages list

Conclusion

● django-whitenoise● django-pipeline● pinax-account-project● Split settings into singular file

Page 15: Django packages list

Thank you