2
0

install.rst 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152
  1. Installation
  2. ============
  3. Basic Installation
  4. ------------------
  5. #. Make a directory (folder) for your project.
  6. #. Create a virtual environment.
  7. **Windows (PowerShell):**
  8. .. code-block:: ps1con
  9. PS> python -m venv .\venv\
  10. PS> .\venv\Scripts\Activate.ps1
  11. **macOS, Linux:**
  12. .. code-block:: console
  13. $ python -m venv ./venv/
  14. $ source ./venv/bin/activate
  15. You can name your virtual environment anything you like. It is just for your use
  16. on your computer.
  17. Learn more about virtual environments by visiting the `Python documentation on virtual
  18. environments here <https://docs.python.org/3/tutorial/venv.html>`_.
  19. .. note::
  20. You will need to be in the directory (folder) of your Wagtail project and have your
  21. virtual environment activated to install dependencies and run your site.
  22. #. Run ``pip install coderedcms``
  23. #. Run ``coderedcms start mysite --sitename "My Company Inc." --domain www.example.com``
  24. .. note::
  25. ``--sitename`` and ``--domain`` are optional to pre-populate settings of your website.
  26. #. Enter the ``mysite`` project with ``cd mysite/``.
  27. #. Run ``python manage.py migrate`` to create the core models.
  28. #. Run ``python manage.py createsuperuser`` to create the initial admin user.
  29. #. Run ``python manage.py runserver`` to launch the development server, and go to
  30. http://localhost:8000 in your browser, or http://localhost:8000/admin/ to log in
  31. with your admin account.
  32. ✨🎉 You now have Wagtail CRX up and running! 🎉✨
  33. Follow the tutorial to build: :doc:`tutorial01`.
  34. You can also play around with our tutorial database. Learn more: :ref:`load-data`.
  35. Professional Installation (includes Sass/SCSS)
  36. ----------------------------------------------
  37. The professional boilerplate includes additional features pre-configured, such as:
  38. * Custom Image and Document models
  39. * Custom User model (using email address as username)
  40. * SCSS compilation (using Python, not Node.js)
  41. * Ruff, MyPy, Pytest tooling pre-configured
  42. To use the professional boilerplate, add ``--template pro`` to the start command:
  43. #. Run ``pip install coderedcms``
  44. #. Run
  45. .. code-block:: console
  46. $ coderedcms start mysite --template pro --sitename "My Company Inc." --domain www.example.com
  47. .. note::
  48. ``--sitename`` and ``--domain`` are optional to pre-populate settings of your website.
  49. #. Enter the ``mysite`` project with ``cd mysite/``.
  50. #. Install the development tooling with:
  51. .. code-block:: console
  52. $ pip install -r requirements.txt -r requirements-dev.txt
  53. #. Run ``python manage.py migrate`` to create the core models.
  54. #. Run ``python manage.py createsuperuser`` to create the initial admin user.
  55. #. Compile the scss code into CSS:
  56. .. code-block:: console
  57. $ python manage.py sass website/static/website/src/custom.scss website/static/website/css/custom.css
  58. .. note::
  59. To build the Sass automatically whenever you change a file, add the
  60. ``--watch`` option and run it in a separate terminal. For more options,
  61. see `django-sass <https://github.com/coderedcorp/django-sass/>`_.
  62. #. Run ``python manage.py runserver`` to launch the development server, and go to
  63. http://localhost:8000 in your browser, or http://localhost:8000/admin/ to log in
  64. with your admin account.
  65. When working with Sass, you will want to look at the base.html file provided at:
  66. ``mysite/website/templates/coderedcms/pages/base.html`` to load in any custom
  67. CSS or JavaScript as needed.
  68. .. _load-data:
  69. Adding Our Tutorial Database
  70. ----------------------------
  71. You can follow along with our tutorial and upload your own pictures and content; however,
  72. we have included our database data from our tutorial project so you can take a tour inside of
  73. the project and play around with it. The database is located in ``website > fixtures > database.json``.
  74. Follow these steps to upload it:
  75. 1. Navigate to the tutorial project in the Command Line by going to ``coderedcms > tutorial > mysite``.
  76. 2. In a fresh virtual environment, type ``pip install -r requirements.txt`` to set up the requirements for the project.
  77. 3. Set up your database like usual. If you want to use a database other than the default ``sqlite3``, you will need to set it up first. It will be an empty database for now.
  78. 4. Do the initial migration for the tutorial site with ``python manage.py migrate``.
  79. 5. Navigate to the ``database.json`` file in the Fixtures folder and copy the path to the file.
  80. 6. From the Command Line, type ``python manage.py loaddata "path/to/database.json"``, replacing that last part with the correct path to the file.
  81. 7. Check to see if it worked by running ``python manage.py runserver``. You should now see our tutorial project with all of the content we have added to the site. It's ready for you to play around with it!
  82. Starter Templates
  83. -----------------
  84. You can start a new Wagtail CRX project with a custom template directory available on
  85. or at a URL using the ``--template`` option. Additionally, we provide some built-in templates:
  86. +------------+-----------------------------------------------------------------+
  87. | Template | Description |
  88. +============+=================================================================+
  89. | ``basic`` | The default starter project. The simplest option, good for most |
  90. | | sites. |
  91. +------------+-----------------------------------------------------------------+
  92. | ``pro`` | Custom Image, Document, User models. Extra tooling to support |
  93. | | SCSS to CSS compilation. Developer tooling such as ruff, mypy, |
  94. | | and pytest. |
  95. +------------+-----------------------------------------------------------------+
  96. .. versionchanged:: 3.0
  97. The "pro" template was added in version 3.0. Previously it was named "sass" and had fewer features.