Nelze vybrat více než 25 témat Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.

development-environment.rst 3.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  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 </internals/sandbox>` site can be used to test our changes in
  10. a browser. 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. You can manually compile the CSS files by running::
  33. make css
  34. .. warning::
  35. If you do submit a pull request that changes the LESS files. Please also
  36. recompile the CSS files and include them in your pull request.
  37. Vagrant
  38. =======
  39. Oscar ships with a Vagrant_ virtual machine that can be used to test integration
  40. with various services in a controlled environment. For instance, it is used to
  41. test that the migrations run correctly in both MySQL and Postgres.
  42. .. _Vagrant: http://vagrantup.com/
  43. Building the Vagrant machine
  44. ----------------------------
  45. To create the machine, first ensure that Vagrant and puppet_ are installed. You will require a
  46. puppet version that supports ``puppet module install``, that is > 2.7.14. Now
  47. run::
  48. make puppet
  49. .. _puppet: http://docs.puppetlabs.com/guides/installation.html
  50. to fetch the required puppet modules for provisioning. Finally, run::
  51. vagrant up
  52. to create the virtual machine and provision it.
  53. Testing migrations against MySQL and Postgres
  54. ---------------------------------------------
  55. To test the migrations against MySQL and Postgres, do the following:
  56. 1. SSH onto the VM::
  57. vagrant ssh
  58. 2. Change to sandbox folder and activate virtualenv::
  59. cd /vagrant/sites/sandbox
  60. source /var/www/virtualenv/bin/activate
  61. 3. Run helper script::
  62. ./test_migrations.sh
  63. This will recreate the Oscar database in both MySQL and Postgres and rebuild
  64. it using ``syncdb`` and ``migrate``.
  65. Testing WSGI server configurations
  66. ----------------------------------
  67. You can browse the Oscar sandbox site in two ways:
  68. * Start Django's development server on port 8000::
  69. vagrant ssh
  70. cd /vagrant/sites/sandbox
  71. source /var/www/virtualenv/bin/activate
  72. ./manage.py runserver 0.0.0.0:8000
  73. The Vagrant machine forwards port 8000 to post 8080 and so the site can be
  74. accessed at http://localhost:8080 on your host machine.
  75. * The Vagrant machine installs Apache2 and mod_wsgi. You can browse the site
  76. through Apache at http://localhost:8081 on your host machine.