install.rst 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  1. Installation
  2. ============
  3. Basic Installation
  4. ------------------
  5. #. Make a directory (folder) for your project.
  6. #. Create a virtual environment.
  7. **Not sure how to create a virtual environment?**
  8. Creating a virtual environment for your project only involves a few commands.
  9. See below:
  10. **Windows (PowerShell):**
  11. .. code-block:: ps1con
  12. PS> python -m venv .\venv\
  13. PS> .\venv\Scripts\Activate.ps1
  14. **macOS, Linux:**
  15. .. code-block:: console
  16. $ python -m venv ./venv/
  17. $ source ./venv/bin/activate
  18. You can name your virtual environment anything you like. It is just for your use
  19. on your computer.
  20. Learn more about virtual environments by visiting the `Python documentation on virtual
  21. environments here <https://docs.python.org/3/tutorial/venv.html>`_.
  22. .. note::
  23. You will need to be in the directory (folder) of your Wagtail project and have your
  24. virtual environment activated to install dependencies and run your site.
  25. #. Run ``pip install wagtail-crx``
  26. #. Run ``wagtailcrx start mysite --sitename "My Company Inc." --domain www.example.com``
  27. .. note::
  28. ``--sitename`` and ``--domain`` are optional to pre-populate settings of your website.
  29. #. Enter the ``mysite`` project with ``cd mysite/``.
  30. #. Run ``python manage.py migrate`` to create the core models.
  31. #. Run ``python manage.py createsuperuser`` to create the initial admin user.
  32. #. Run ``python manage.py runserver`` to launch the development server, and go to
  33. http://localhost:8000 in your browser, or http://localhost:8000/admin/ to log in
  34. with your admin account.
  35. ✨🎉 You now have Wagtail CRX up and running! 🎉✨
  36. Follow the tutorial to build :doc:`tutorial01`
  37. Installing with Sass Support
  38. ----------------------------
  39. To create a project that is pre-configured to use Sass for CSS compilation:
  40. #. Run ``pip install wagtail-crx``
  41. #. Run
  42. .. code-block:: console
  43. $ wagtailcrx start mysite --template sass --sitename "My Company Inc." --domain www.example.com
  44. .. note::
  45. ``--sitename`` and ``--domain`` are optional to pre-populate settings of your website.
  46. #. Enter the ``mysite`` project with ``cd mysite/``.
  47. #. Install the development tooling with:
  48. .. code-block:: console
  49. $ pip install -r requirements.txt -r requirements-dev.txt
  50. #. Run ``python manage.py migrate`` to create the core models.
  51. #. Run ``python manage.py createsuperuser`` to create the initial admin user.
  52. #. Compile the scss code into CSS:
  53. .. code-block:: console
  54. $ python manage.py sass website/static/website/src/custom.scss website/static/website/css/custom.css
  55. .. note::
  56. To build the Sass automatically whenever you change a file, add the
  57. ``--watch`` option and run it in a separate terminal. For more options,
  58. see `django-sass <https://github.com/coderedcorp/django-sass/>`_.
  59. #. Run ``python manage.py runserver`` to launch the development server, and go to
  60. http://localhost:8000 in your browser, or http://localhost:8000/admin/ to log in
  61. with your admin account.
  62. When working with Sass, you will want to look at the base.html file provided at:
  63. ``mysite/website/templates/wagtailcrx/pages/base.html`` to load in any custom
  64. CSS or JavaScript as needed.
  65. Starter Templates
  66. -----------------
  67. You can start a new Wagtail CRX project with a custom template directory available on
  68. or at a URL using the ``--template`` option. Additionally, we provide some built-in templates:
  69. +------------+-----------------------------------------------------------------+
  70. | Template | Description |
  71. +============+=================================================================+
  72. | ``basic`` | The default starter project. The simplest option, good for most |
  73. | | sites. |
  74. +------------+-----------------------------------------------------------------+
  75. | ``sass`` | Similar to basic, but with extra tooling to support SCSS to CSS |
  76. | | compilation. |
  77. +------------+-----------------------------------------------------------------+