install.rst 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141
  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 coderedcms``
  26. #. Run ``coderedcms 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. You can also play around with our tutorial database. Learn more: :ref:`load-data`.
  38. Installing with Sass Support
  39. ----------------------------
  40. To create a project that is pre-configured to use Sass for CSS compilation:
  41. #. Run ``pip install coderedcms``
  42. #. Run
  43. .. code-block:: console
  44. $ coderedcms start mysite --template sass --sitename "My Company Inc." --domain www.example.com
  45. .. note::
  46. ``--sitename`` and ``--domain`` are optional to pre-populate settings of your website.
  47. #. Enter the ``mysite`` project with ``cd mysite/``.
  48. #. Install the development tooling with:
  49. .. code-block:: console
  50. $ pip install -r requirements.txt -r requirements-dev.txt
  51. #. Run ``python manage.py migrate`` to create the core models.
  52. #. Run ``python manage.py createsuperuser`` to create the initial admin user.
  53. #. Compile the scss code into CSS:
  54. .. code-block:: console
  55. $ python manage.py sass website/static/website/src/custom.scss website/static/website/css/custom.css
  56. .. note::
  57. To build the Sass automatically whenever you change a file, add the
  58. ``--watch`` option and run it in a separate terminal. For more options,
  59. see `django-sass <https://github.com/coderedcorp/django-sass/>`_.
  60. #. Run ``python manage.py runserver`` to launch the development server, and go to
  61. http://localhost:8000 in your browser, or http://localhost:8000/admin/ to log in
  62. with your admin account.
  63. When working with Sass, you will want to look at the base.html file provided at:
  64. ``mysite/website/templates/coderedcms/pages/base.html`` to load in any custom
  65. CSS or JavaScript as needed.
  66. .. _load-data:
  67. Adding Our Tutorial Database
  68. ----------------------------
  69. You can follow along with our tutorial and upload your own pictures and content; however,
  70. we have included our database data from our tutorial project so you can take a tour inside of
  71. the project and play around with it. The database is located in ``website > fixtures > database.json``.
  72. Follow these steps to upload it:
  73. 1. Navigate to the tutorial project in the Command Line by going to ``coderedcms > tutorial > mysite``.
  74. 2. In a fresh virtual environment, type ``pip install -r requirements.txt`` to set up the requirements for the project.
  75. 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.
  76. 4. Do the initial migration for the tutorial site with ``python manage.py migrate``.
  77. 5. Navigate to the ``database.json`` file in the Fixtures folder and copy the path to the file.
  78. 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.
  79. 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!
  80. Starter Templates
  81. -----------------
  82. You can start a new Wagtail CRX project with a custom template directory available on
  83. or at a URL using the ``--template`` option. Additionally, we provide some built-in templates:
  84. +------------+-----------------------------------------------------------------+
  85. | Template | Description |
  86. +============+=================================================================+
  87. | ``basic`` | The default starter project. The simplest option, good for most |
  88. | | sites. |
  89. +------------+-----------------------------------------------------------------+
  90. | ``sass`` | Similar to basic, but with extra tooling to support SCSS to CSS |
  91. | | compilation. |
  92. +------------+-----------------------------------------------------------------+