Package: coldcms
GoalA fully functional CMS optimized for low consumption.Read blog postsabout this.BenchmarkBenchmark details to ColdcmsDescriptionColdCMS is aDjangoproject based onWagtail CMSandBulmaCSS framework.The admin can edit websites through an intuitive and user-friendly interface. Different types of pages are pre-designed, making it possible
to have a nice-looking website without spending hours on it.ColdCMS is especially designed for people who want to reduce the impact of their use of digital technologies on the environnement.The client website consists of static pages, built withWagtail bakery. The website pages
are generated and updated when necessary (e.g. when the admin publishes or modifies content).Among other optimizations, the size of CSS files is reduced and unused CSS code is removed, usingPurgeCSSandclean-css.ColdCMS supports Python >= 3.6.How to use ColdCMS?You have access to a ColdCMS instance and you want to create a websiteYou can find the user documentation here:English documentationDocumentation en françaisYou want to install ColdCMSYou have two options: docker installation or manual installation.Docker installationYou will need docker-compose and docker with a running daemon.We provide a sampledocker/docker-compose.ymlfile. Feel free to modify it for your needs.cddocker&&docker-composeupHere are some env variables that you might want to change:POSTGRES_USER,POSTGRES_PASSWORD,POSTGRES_DBseehttps://github.com/docker-library/docs/blob/master/postgres/README.md#environment-variablesDB_URL, the database connection URL, seehttps://github.com/jacobian/dj-database-url#url-schemaSECRET_KEY, theDjango SECRET_KEY,
it should be a private, 40-character long randomly-generated stringALLOWED_HOSTS, the coma-separated list of hosts allowed to serve your application, corresponds to theDjango ALLOWED_HOSTSYou can then create an admin user which will have access tohttp://localhost/admindockerexec-itdocker_backend_1python3manage.pycreatesuperuserManual installation1. Choose a databaseWe recommend usingPostgreSQL, but you can also use the defaultSQLite(no setup required). If you choose to usePostgreSQLtake note of the host, port, database, user, and password you’re using.2. Install the backend part of ColdCMSThe backend is used to modify your website, it’s located onhttps://your-site.tld/adminDownload the latest release available here:https://gitlab.com/hashbangfr/coldcms/-/releases(orgit clonethe project, as you want)Then you’ll need to launch thewsgiapplication located here:https://gitlab.com/hashbangfr/coldcms/-/blob/master/coldcms/wsgi.pyYou can do this using several projects:uwsgi(our preferred approach)mod_wsgi (apache)CherryPyand so on..You’ll have to pass some environment variables to the wsgi process (uwsgi for example), for the application to work as expected:DB_URL=postgres://coldcms:coldcms@db_host:5432/coldcms# adapt this for your setup, if you choose to useSQLiteyou can omit itBUILD_DIR=/srv/build# the directory under which the generated website will go,
this directory will be served by your webserver (ex: nginx)STATIC_ROOT=/srv/build/static/#Django STATIC_ROOTthis directory needs to be served by your file server (ex: nginx) as wellSECRET_KEY=CHANGE_ME#Django SECRET_KEYit should be a private, 40-character long randomly-generated stringALLOWED_HOSTS=localhost,127.0.0.1,your-domain.tld, the coma-separated list of hosts allowed to serve your application, corresponds to theDjango ALLOWED_HOSTSHere is a working example usinguwsgi, with the application located under/srv/appand usingSQLite:[uwsgi]socket = 0.0.0.0:8000chdir = /srv/app/module = coldcms.wsgi:applicationmaster = trueprocesses = 4threads = 2uid = coldcmsgid = coldcmsbuffer-size = 65535env = BUILD_DIR=/srv/buildenv = STATIC_ROOT=/srv/build/static/env = SECRET_KEY=something_big_and_random3. Setup Nginx to work with the backendNginx acts like a file server which serves the static website generated by the backend. You can choose any kind of file server as long as
it can :serve files efficiently (HTML / images / assets …)proxy requests to/adminto the actual ColdCMS backend (set up on the 2nd step)An example of a functional nginx config is available here:https://gitlab.com/hashbangfr/coldcms/-/blob/manual-install-doc/docker/nginx/nginx.conf4 locations need to be served:/admin-> proxy to the python ColdCMS backend (step 2)/-> serve the HTML files generated by the backend (seeBUILD_DIRin step 2)/media-> serve the medias files uploaded by the admin (it corresponds to$BUILD_DIR/media)/static-> serve the static files (seeSTATIC_ROOTin step 2)Feel free to adapt it for your needsYou are a developer and you want to quickly have a lookNote:this has only been tested on Linux environments.Install ColdCMS with pypi:pipinstallcoldcmsRun the quick launch command:python-mcoldcmsBefore this command you can set the following environment variables :RUN_DJANGO_MIGRATION=0: do not run the migrationsSETUP_INITIAL_DATA=0: do not setup the initial data, in case you want to keep the data you already have in your coldcms databaseCOLLECT_STATIC=0: do not collect the static files. Don’t set that variable to 0 if it is your first time launching ColdCMS.CREATE_SUPERUSER=0: do not create a new superuser (you can have several superuser at a time, but not with the same username or email)BUILD_ASSETS=0: do not build build assets. Don’t set that variable to 0 if it is your first time launching ColdCMS.BUILD_STATIC=0: do not build static files. Don’t set that variable to 0 if you’ve also set SETUP_INITIAL_DATA to 0.Example:CREATE_SUPERUSER=0 python-mcoldcmswill run the migrations, setup some new initial data, but will not create a new superuser.You are a developer and you want to contribute to ColdCMSClone the gitlab repository, and read theDevsection below to install the ColdCMS development environment.Follow thecontribution guidelines.DevNote:this has only been tested on Linux environments.1. Install the dependenciesInstalllibjpegandzlib, needed to work with images through thePillowlibrary.
If you have a debian-based distribution, use the following commands:sudoapt-getinstallzlib1g-devsudoapt-getinstalllibjpeg-devAlso, please install PurgeCSS and clean-css, to reduce the size of CSS files:npminstall-gpurgecss@2.1.0clean-css-cli@4.3.0And to continue with javascript, please install static dependencies :(cdcoldcms/static/&&npmi--save-dev)We use sass to transpile sass files to CSS. Make sure that the binarysassfrom thesasscpackage is present in your $PATH.
In debian-based distributions, run the following:sudoapt-getinstallsasscsudoln-s/usr/bin/sassc/usr/bin/sass# might be necessary if /usr/bin/sass doesn't exist after the previous commandFinally, run:pipinstall-rrequirements_dev.txt2. Create a databaseBy default,./manage.py migratewill create a sqlite3 database namedcoldcms.If you want to use a different database engine, you can specify it in the environment variableDB_URL. Make sure you have the
proper database driver for the engine you want to use.If you want to use a different name for your sqlite database, you can specify it in the environment variableDB_NAME(useless for some engines as it is directly specified in the url - see table below).As advised in thedjango documentation, if you’re new to
databases, or you’re just interested in trying ColdCMS, use the default sqlite3 database, it is included in Python, so you won’t need to
install anything else to support your database. When starting your first real project, however, you may want to use a more scalable
database like PostgreSQL, to avoid database-switching headaches down the road.EngineDB_URLPostgreSQLpostgres://USER:PASSWORD@HOST:PORT/NAMEPostGISpostgis://USER:PASSWORD@HOST:PORT/NAMEMSSQLmssql://USER:PASSWORD@HOST:PORT/NAMEMySQLmysql://USER:PASSWORD@HOST:PORT/NAMEMySQL (GIS)mysqlgis://USER:PASSWORD@HOST:PORT/NAMESQLitesqlite:///PATHSpatiaLitespatialite:///PATHOracleoracle://USER:PASSWORD@HOST:PORT/NAMEOracle (GIS)oraclegis://USER:PASSWORD@HOST:PORT/NAMERedshiftredshift://USER:PASSWORD@HOST:PORT/NAMEReplace PATH, USER, PASSWORD, HOST, PORT and NAME with the correct values.SourceFor example, if you want to use PostgreSQL :systemctlstatuspostgresql# make sure postgresql is runningcreatedbcoldcms# create the coldcms postgres databasesudo-upostgrespsqlCREATEUSERusernamePASSWORD'password';ALTERROLEusernameWITHSUPERUSER;\qexportDB_URL="postgres://username:password@localhost:5432/coldcms"3. Launch the development server./manage.pymigrate./manage.pycollectstatic./manage.pycompilemessages./manage.pycreatesuperuser./manage.pysetup_initial_data# optional - loads data of a basic home page./manage.pyrunserverIf collectstatic doesn’t work, try :cdcoldcms/static&&npmicd../..&&./manage.pyassetsbuildCustom theme for ColdCMS?You can override coldcms style with your own theme.You can create a Theme with the following command :./manage.pycollecttheme<theme>That will create a directory theme at coldcms root.
You can also create this directory everywhere you want. This directory must have the following structure<theme>
├── static
│   ├── scss
│   │   └── <theme>.scss
|   |   └── theme_variables.scss
│   └── svg
└── templatesYou have to set theme name and theme directory as environment variablesTHEME for theme nameTHEME_DIR for path to theme directoryThere is also an option to customize the theme path :./manage.pycollecttheme<theme>--directory=<path>To override a specific template, in the templates directory of your theme, add the directoryTo override a specific template file, in the “templates” folder of your theme, you need to add a folder named like the original folder containing the template file. Then you must create the template file with the same name as well.Example :Original struct:generic_page <app>
└── templates
    └── generic_page
        └── generic_page.htmlIn your theme:<theme>
└── templates
    └── generic_page
        └── generic_page.htmlFinally, for the surcharge to be properly applied, you will need to define the name and path of your theme.
In the settings/base.py file there are the global variables “THEME” and “THEME_DIR” provided for this purpose.
If you do not want to modify the settings.py file, you can define these variables with the terminal :exportTHEME=<theme>exportTHEME_DIR=<paththeme>