install.rst 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161
  1. .. _installation:
  2. Installation
  3. ============
  4. .. note::
  5. The tutorial uses the pro template. We recommend all serious websites start with the pro template for best flexibility:
  6. :ref:`sass_install`
  7. Basic Installation
  8. ------------------
  9. #. Make a directory (folder) for your project.
  10. #. Create a virtual environment.
  11. **Windows (PowerShell):**
  12. .. code-block:: ps1con
  13. PS> python -m venv .\venv\
  14. PS> .\venv\Scripts\Activate.ps1
  15. **macOS, Linux:**
  16. .. code-block:: console
  17. $ python -m venv ./venv/
  18. $ source ./venv/bin/activate
  19. You can name your virtual environment anything you like. It is just for your use
  20. on your computer.
  21. Learn more about virtual environments by visiting the `Python documentation on virtual
  22. environments here <https://docs.python.org/3/tutorial/venv.html>`_.
  23. #. In your virtual environment, install CRX:
  24. .. code-block:: console
  25. $ pip install coderedcms
  26. #. Create a new project:
  27. .. code-block:: console
  28. $ coderedcms start mysite --sitename "My Company Inc." --domain "www.example.com"
  29. *``--sitename`` and ``--domain`` are optional to pre-populate settings of your website.*
  30. #. Next, enter the new project folder and set up Django.
  31. .. code-block:: console
  32. $ python manage.py migrate
  33. $ python manage.py createsuperuser
  34. #. Now, you can run a local development server:
  35. .. code-block:: console
  36. $ python manage.py runserver
  37. Go to http://localhost:8000 in your browser, or http://localhost:8000/admin/ to log in with your admin account.
  38. ✨🎉 You now have Wagtail CRX up and running! 🎉✨
  39. .. _sass_install:
  40. Professional Installation
  41. -------------------------
  42. The professional boilerplate includes additional features pre-configured, such as:
  43. * Custom Image and Document models.
  44. * Custom User model (using email address as username).
  45. * Custom Navbar and Footer.
  46. * SCSS compilation (using Python, not Node.js).
  47. * Ruff, MyPy, Pytest tooling pre-configured.
  48. To use the professional boilerplate, add ``--template pro`` to the start command:
  49. #. In your virtual environment, install CRX:
  50. .. code-block:: console
  51. $ pip install coderedcms
  52. #. Create a new project:
  53. .. code-block:: console
  54. $ coderedcms start mysite --template pro --sitename "My Company Inc." --domain "www.example.com"
  55. *``--sitename`` and ``--domain`` are optional to pre-populate settings of your website.*
  56. #. Next, enter the new project folder:
  57. .. code-block:: console
  58. $ cd mysite/
  59. #. Install the development tooling with:
  60. .. code-block:: console
  61. $ pip install -r requirements-dev.txt
  62. #. Next, set up Django.
  63. .. code-block:: console
  64. $ python manage.py migrate
  65. $ python manage.py createsuperuser
  66. #. Compile the scss code into CSS:
  67. .. code-block:: console
  68. $ python manage.py sass website/static/website/src/custom.scss website/static/website/css/custom.css
  69. .. note::
  70. To build the Sass automatically whenever you change a file, add the
  71. ``--watch`` option and run it in a separate terminal. For more options,
  72. see `django-sass <https://github.com/coderedcorp/django-sass/>`_.
  73. #. Now, you can run a local development server:
  74. .. code-block:: console
  75. $ python manage.py runserver
  76. Go to http://localhost:8000 in your browser, or http://localhost:8000/admin/ to log in with your admin account.
  77. When working with Sass, you will want to look at the base.html file provided at:
  78. ``mysite/website/templates/coderedcms/pages/base.html`` to load in any custom
  79. CSS or JavaScript as needed.
  80. Follow the tutorial to build a website with us: :doc:`tutorial01`.
  81. Starter Templates
  82. -----------------
  83. You can start a new Wagtail CRX project with a custom template directory available on
  84. or at a URL using the ``--template`` option. Additionally, we provide some built-in templates:
  85. +------------+-----------------------------------------------------------------+
  86. | Template | Description |
  87. +============+=================================================================+
  88. | ``basic`` | The default starter project. The simplest option, good for most |
  89. | | sites. |
  90. +------------+-----------------------------------------------------------------+
  91. | ``pro`` | Custom Image, Document, User models. Extra tooling to support |
  92. | | SCSS to CSS compilation. Custom Navbar and Footer. Developer |
  93. | | tooling such as ruff, mypy, and pytest. |
  94. +------------+-----------------------------------------------------------------+
  95. .. versionchanged:: 3.0
  96. The "pro" template was added in version 3.0. Previously it was named "sass" and had fewer features.