You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

deploying.rst 2.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. .. spelling::
  2. Memcached
  3. Redis
  4. Sorl
  5. ===============
  6. Deploying Oscar
  7. ===============
  8. Oscar is a just a set of Django apps - it doesn't have any special deployment
  9. requirements. That means the excellent Django docs for `deployment`_ should be
  10. your first stop. This page adds some additional tips based on experience gained
  11. from running Oscar projects.
  12. Performance
  13. -----------
  14. Setting up caching is crucial for a good performance. Oscar's templates are
  15. split into many partials, hence it is recommended to use the
  16. `cached template loader`_. Sorl also will hit your database hard if you run it
  17. without a cache backend.
  18. If your memory constraints are tight and you can only run one Python worker,
  19. LocMemCache will usually outperform external cache backends due to the lower
  20. overhead. But once you can scale beyond one worker, it might make good sense to
  21. switch to something like Memcached or Redis.
  22. Blocking in views should be avoided if possible. That is especially true for
  23. external API calls and sending emails. Django's supports different email
  24. backends to allow for switching out the blocking SMTP backend to a custom
  25. non-blocking solution. Possible options are storing emails in a database or
  26. cache for later consumption or triggering an external worker, e.g. via
  27. `django-celery`_. `django_post-office`_ works nicely.
  28. For backwards-compatibility reasons, Django doesn't enable database connection
  29. pooling by default. Performance is likely to improve when enabled.
  30. Security
  31. --------
  32. Oscar relies on the Django framework for security measures and therefore no
  33. Oscar specific configurations with regard to security are in place. See
  34. `Django's guidelines for security`_ for more information.
  35. `django-secure`_ is a nice app that comes with a few sanity checks for
  36. deployments behind SSL.
  37. Search Engine Optimisation
  38. --------------------------
  39. A basic example of what a sitemap for Oscar could look like has been added
  40. to the sandbox site. Have a look at ``sandbox/urls.py`` for inspiration.
  41. .. _deployment: https://docs.djangoproject.com/en/stable/howto/deployment/
  42. .. _`Django's guidelines for security`: https://docs.djangoproject.com/en/stable/topics/security/
  43. .. _`cached template loader`: https://docs.djangoproject.com/en/stable/ref/templates/api/#django.template.loaders.cached.Loader
  44. .. _django-celery: http://www.celeryproject.org/
  45. .. _django-secure: https://pypi.python.org/pypi/django-secure
  46. .. _django_post-office: https://github.com/ui/django-post_office