Quokka CMS

Quokka CMS is a Flask-powered, flexible Python CMS with a number of different themes available to suit anyone’s taste. It is easy to use and can be extended with a vast variety of useful modules. Also, this content management system provides a number of additional features you can benefit on, such as: customizable administrator interface, channel-based organization of content, role-based access control, etc.

In this instruction, we will find out how you can deploy and run your own Quokka CMS instance with the help of MongoDB and Flask – micro-framework, which is commonly used for developing simple applications on the base of number of available templates. So, follow the detailed guidance below to accomplish this:

Create an Environment #

To start with, let’s prepare a separate environment for our project by following the next instructions:

1. Press the New Environment button at the top pane of the dashboard.quokka cms 01create

2. In the opened topology wizard, navigate to the Python programming language tab. Here, the Apache application server will be chosen automatically as the only available one, so just add the MongoDB node within the NoSQL database section.quokka cms 02wizard 7Specify cloudlet limits for the chosen nodes, select the region, enter the desired environment name (e.g. quokka), and click Create.

3. Your environment will appear at the dashboard in a minute.quokka cms 03dash

Configure MongoDB #

Now it’s time to create a new dedicated database, where all of the Quokka CMS data will be stored.

1. Press the Open in browser button next to the MongoDB node.quokka cms 04oib mongo

2. Within the opened page, log in to the MongoDB administration panel with credentials you’ve received via email after the environment creation.quokka cms 05login

3. Once authorized, move to the Databases section by clicking the appropriate button at the top pane. Locate the Create Database section inside and specify the name for a new database within it (e.g quokka).quokka cms 06db save 1

Press Save when ready.

4. In a moment your new database will appear at the list, so you can move on and switch to the Execute panel tab. Here, you need to create an admin user for the DB by executing the corresponding piece of code:

db.createUser({user:"{name}", pwd:"{password}", roles:[{role:"readWrite", db:"{db_name}"}]})

where

  • {name} – name of a new database user
  • {password} – password for your user
  • {db_name} – name of the database you’ve created in the previous step

Note: The admin username refers to the default MongoDB user, so, obviously, you can’t use it as a name for your user.

quokka cms 08exec button var 3

Select your database within the drop down list and click the Execute button below to finish the DB configuration.

Build and Deploy Quokka CMS #

After all the preparations are done, you can proceed directly to the Quokka CMS building and deploying to the CirrusGrid platform.

1. Access your Apache application server via the CirrusGrid SSH Gateway.

2. In order to get the ability to install the required packages without having the administrator privileges, you need to create an isolated virtual Python environment inside the container and, subsequently, perform all the actions there. So, execute the following commands for that:
virtualenv virtenv  
source virtenv/bin/activate

quokka cms 09step2 3

3. Now, you should remove the default pre-installed application and deploy Quokka CMS app using the GIT repository as a source:

rm -rf ROOT; git clone https://github.com/pythonhub/quokka.git ROOT

quokka cms 09step4

4. Navigate to the ROOT folder with application files you’ve just downloaded and install the required Python modules (they are already listed within the requirements.txt file):

cd ROOT  
pip install -r requirements/requirements.txt

quokka cms 09step5

5. Next, let’s specify the database connection data. Execute the vim quokka/settings.py command to open the appropriate configuration file, where you need to find the following strings and replace the default values with your own ones:

MONGODB_DB = {db_name}
MONGODB_HOST = '{db_ip}'
MONGODB_PORT = 27017
MONGODB_USERNAME = "{name}"
MONGODB_PASSWORD = "{password}"

where:

  • {db_name} – name of your database
  • {db_ip} – IP address of your MongoDB node
  • {name} – name of the admin user you’ve created earlier
  • {password} – password for this admin userquokka cms 10db config var 1

    In order to save the changes and exit from the vim editor, use the :wq command.

    6. Then, enter the vim wsgi.py command and specify the application entry point for mod_wsgi module by replacing the default content of the opened file with the following lines:

    #!/usr/bin/python
    
    import os,sys
    virtenv = os.path.expanduser('~') + '/virtenv/'
    virtualenv = os.path.join(virtenv, 'bin/activate_this.py')
    try:
        exec(open(virtualenv).read(), dict(__file__=virtualenv))
    except IOError:
        pass
    
    sys.path.append(os.path.expanduser('~'))
    sys.path.append(os.path.expanduser('~') + '/ROOT/')
    
    from werkzeug.serving import run_simple
    from werkzeug.wsgi import DispatcherMiddleware
    
    from quokka import create_app, create_api
    
    application = DispatcherMiddleware(create_app(), {
        '/api': create_api()
    })
    
    if __name__ == "__main__":
        run_simple(
        '0.0.0.0',
        5000,
        application,
        use_reloader=True,
        use_debugger=True
        )

    quokka cms 13wsgi

    Save the changes you’ve made and exit the editor.

    7. At last, let’s add a symlink for binding server’s entry point to the just modified file:

    ln -s ~/ROOT/wsgi.py ~/ROOT/application

    8. That’s all! Now you can return to the dashboard and press the Open in browser button next to your environment to launch your Quokka CMS.quokka cms 14oib app

    Tip: Take into consideration that applications, which were deployed via SSH, are not displayed at the CirrusGrid dashboards' Deployed column.

    As a result, you will see the application’s welcome page with the automatically generated admin credentials stated, so you can instantly log in and start exploring.

    quokka cms 15homepage

    Enjoy working with your own Quokka CMS application, hosted at CirrusGrid Cloud!

    If you experience any difficulties while configuring or deploying Quokka CMS, you can appeal for our technical experts' assistance at Stackoverflow.

    Powered by BetterDocs