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

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