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.

development-environment.rst 3.3KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  1. ======================================
  2. Setting up the development environment
  3. ======================================
  4. Fork the repo and run::
  5. git clone git@github.com:<username>/django-oscar.git
  6. cd django-oscar
  7. mkvirtualenv oscar # using virtualenvwrapper
  8. make install
  9. The :doc:`sandbox <sandbox>` site can be used to test our changes in a browser.
  10. It is easily created with ``make sandbox``.
  11. Writing LESS/CSS
  12. ================
  13. Oscar's CSS files are build using LESS_. However, the sandbox defaults to
  14. serving CSS files directly, bypassing LESS compilation.
  15. .. _LESS: http://lesscss.org/
  16. If you want to develop the LESS files, set::
  17. USE_LESS = True
  18. COMPRESS_ENABLED = False
  19. in ``sites/sandbox/settings_local.py``. This will cause Oscar to use
  20. `django-compressor`_ to compile the LESS files as they are requested. For this to
  21. work, you will need to ensure that the LESS compiler ``lessc`` is installed.
  22. This can be acheived by running::
  23. pip install -r requirements_less.txt
  24. .. _`django-compressor`: http://django_compressor.readthedocs.org/en/latest/
  25. which will install the `virtual-node`_ and `virtual-less`_ packages, which will
  26. install node.js and LESS in your virtualenv.
  27. .. _`virtual-node`: https://github.com/elbaschid/virtual-node
  28. .. _`virtual-less`: https://github.com/elbaschid/virtual-less
  29. If you have npm installed already,
  30. you install LESS using::
  31. npm install less
  32. .. warning::
  33. If you do submit a pull request that changes the LESS files. Please also
  34. recompile the CSS files and include them in your pull request.
  35. Vagrant
  36. =======
  37. Oscar ships with a Vagrant_ virtual machine that can be used to test integration
  38. with various services in a controlled environment. For instance, it is used to
  39. test that the migrations run correctly in both MySQL and Postgres.
  40. .. _Vagrant: http://vagrantup.com/
  41. Building the Vagrant machine
  42. ----------------------------
  43. To create the machine, first ensure that Vagrant and puppet_ are installed. You will require a
  44. puppet version that supports ``puppet module install``, that is > 2.7.14. Now
  45. run::
  46. make puppet
  47. .. _puppet: http://docs.puppetlabs.com/guides/installation.html
  48. to fetch the required puppet modules for provisioning. Finally, run::
  49. vagrant up
  50. to create the virtual machine and provision it.
  51. Testing migrations against MySQL and Postgres
  52. ---------------------------------------------
  53. To test the migrations against MySQL and Postgres, do the following:
  54. 1. SSH onto the VM::
  55. vagrant ssh
  56. 2. Change to sandbox folder and activate virtualenv::
  57. cd /vagrant/sites/sandbox
  58. source /var/www/virtualenv/bin/activate
  59. 3. Run helper script::
  60. ./test_migrations.sh
  61. This will recreate the Oscar database in both MySQL and Postgres and rebuild
  62. it using ``syncdb`` and ``migrate``.
  63. Testing WSGI server configurations
  64. ----------------------------------
  65. You can browse the Oscar sandbox site in two ways:
  66. * Start Django's development server on port 8000::
  67. vagrant ssh
  68. cd /vagrant/sites/sandbox
  69. source /var/www/virtualenv/bin/activate
  70. ./manage.py runserver 0.0.0.0:8000
  71. The Vagrant machine forwards port 8000 to post 8080 and so the site can be
  72. accessed at http://localhost:8080 on your host machine.
  73. * The Vagrant machine installs Apache2 and mod_wsgi. You can browse the site
  74. through Apache at http://localhost:8081 on your host machine.