Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

installation.rst 2.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. Installing django-oscar
  2. =======================
  3. Environment
  4. -----------
  5. Install pip and virtualenv (if you haven't already)::
  6. sudo apt-get install python-setuptools
  7. sudo easy_install pip
  8. sudo pip install virtualenv virtualenvwrapper
  9. echo "source /usr/local/bin/virtualenvwrapper.sh" >> ~/.bashrc
  10. Create a new virtual env::
  11. mkvirtualenv --no-site-packages $PROJECTNAME
  12. Install oscar and its dependencies::
  13. pip install -e git+git://github.com/codeinthehole/django-oscar.git#egg=django-oscar
  14. This will install Django and a few other packages. Now create the project
  15. cd /path/to/my/workspace
  16. django-admin.py startproject $PROJECTNAME
  17. A nice extension now is to edit your ``~/.virtualenv/$PROJECTNAME/bin/postactivate`` file to contain::
  18. cd ~/path/to/my/workspace/$PROJECTNAME
  19. so that you can simply type ``workon $PROJECTNAME`` to jump into your project folder with the virtual
  20. environment set-up.
  21. Configure settings
  22. ------------------
  23. * Add ``'django.middleware.transaction.TransactionMiddleware'`` to your ``MIDDLEWARE_CLASSES`` tuple, making
  24. sure it comes BEFORE ``'django.contrib.auth.middleware.AuthenticationMiddleware'``.
  25. * Uncomment ``django.contrib.admin`` from ``INSTALLED_APPS``.
  26. Add the following to your `INSTALLED_APPS`::
  27. 'oscar',
  28. 'oscar.order',
  29. 'oscar.checkout',
  30. 'oscar.order_management',
  31. 'oscar.product',
  32. 'oscar.basket',
  33. 'oscar.payment',
  34. 'oscar.offer',
  35. 'oscar.address',
  36. 'oscar.stock',
  37. 'oscar.image',
  38. 'oscar.shipping',
  39. 'oscar.customer',
  40. 'oscar.search',
  41. Now fill in the normal settings (not related to django-oscar) within ``settings.py`` - eg ``DATABASES``, ``TIME_ZONE`` etc
  42. A vanilla install of django-oscar is now ready, you could now finish the process by running::
  43. ./manage.py syncdb
  44. However, in reality you will need to start extending the models to match your domain. It's best to do
  45. this before creating your initial schema.
  46. Configure urls
  47. --------------
  48. Oscar comes with a number of urls and views out of the box. These are
  49. recommendations rather than a requirement but you easily use them in your
  50. e-commerce site by adding the oscar urls to your projects local ``urls.py``
  51. (r'^', include('oscar.urls')),
  52. This will bring in all of oscar's defined urls. Of course you can pull in the
  53. urls for the individual apps if you prefer or simply define your own