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.

installation.rst 3.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  1. =======================
  2. Installing django-oscar
  3. =======================
  4. Environment
  5. -----------
  6. This section is optional but recommended.
  7. Install pip and virtualenv (if you haven't already)::
  8. sudo apt-get install python-setuptools
  9. sudo easy_install pip
  10. sudo pip install virtualenv virtualenvwrapper
  11. echo "source /usr/local/bin/virtualenvwrapper.sh" >> ~/.bashrc
  12. Create a new virtual env::
  13. mkvirtualenv --no-site-packages $PROJECTNAME
  14. A nice extension now is to edit your ``~/.virtualenv/$PROJECTNAME/bin/postactivate`` file to contain::
  15. cd ~/path/to/my/workspace/$PROJECTNAME
  16. so that you can simply type ``workon $PROJECTNAME`` to jump into your project folder with the virtual
  17. environment set-up.
  18. Installation
  19. ------------
  20. Install oscar and its dependencies::
  21. pip install -e git+git://github.com/tangentlabs/django-oscar.git#egg=django-oscar
  22. You will also need to install the appropriate python module for your database of choice.
  23. If you are using MySQL, then run the following::
  24. pip install MySQL-python
  25. Also, depending on your search backend for haystack, you'll need to install further
  26. packages::
  27. pip install pysolr
  28. Now create the project::
  29. cd /path/to/my/workspace
  30. django-admin.py startproject $PROJECTNAME
  31. Configure ``settings.py``
  32. -------------------------
  33. * Add ``'django.middleware.transaction.TransactionMiddleware'`` to your ``MIDDLEWARE_CLASSES`` tuple, making
  34. sure it comes AFTER ``'django.contrib.auth.middleware.AuthenticationMiddleware'``.
  35. * Add the following to your `INSTALLED_APPS`::
  36. 'haystack',
  37. 'oscar',
  38. 'oscar.apps.analytics',
  39. 'oscar.apps.discount',
  40. 'oscar.apps.order',
  41. 'oscar.apps.checkout',
  42. 'oscar.apps.shipping',
  43. 'oscar.apps.order_management',
  44. 'oscar.apps.product',
  45. 'oscar.apps.basket',
  46. 'oscar.apps.payment',
  47. 'oscar.apps.offer',
  48. 'oscar.apps.address',
  49. 'oscar.apps.partner',
  50. 'oscar.apps.image',
  51. 'oscar.apps.customer',
  52. 'oscar.apps.promotions',
  53. 'oscar.apps.reports',
  54. 'oscar.apps.search',
  55. 'oscar.apps.catalogue_import',
  56. * Add these to ``TEMPLATE_CONTECT_PROCESSORS``::
  57. 'oscar.apps.search.context_processors.search_form',
  58. 'oscar.apps.promotions.context_processors.promotions',
  59. 'oscar.apps.promotions.context_processors.merchandising_blocks',
  60. * Import default settings::
  61. from oscar.defaults import *
  62. * If using Solr, configure it::
  63. HAYSTACK_SITECONF = 'oscar.search_sites'
  64. HAYSTACK_SEARCH_ENGINE = 'solr'
  65. HAYSTACK_SOLR_URL = 'http://127.0.0.1:8080/solr'
  66. HAYSTACK_INCLUDE_SPELLING = True
  67. Now fill in the normal settings (not related to django-oscar) within ``settings.py`` - eg ``DATABASES``, ``TIME_ZONE`` etc
  68. A vanilla install of django-oscar is now ready, you could now finish the process by running::
  69. ./manage.py syncdb
  70. However, in reality you will need to start extending the models to match your domain. It's best to do
  71. this before creating your initial schema.
  72. Configure URLs
  73. --------------
  74. Oscar comes with a number of urls and views out of the box. These are
  75. recommendations rather than a requirement but you easily use them in your
  76. e-commerce site by adding the oscar urls to your projects local ``urls.py``::
  77. (r'^', include('oscar.urls')),
  78. This will bring in all of oscar's defined urls. Of course you can pull in the
  79. urls for the individual apps if you prefer or simply define your own