Hosting your static app on Divshot - Part 1

Part 1 | Part 2 | Part 3

Divshot is a specialized hosting service for modern apps, in particular apps developped the static way, and I decided to use it for all my current projects that fit this category. Check out their list of features here.

In this first part of a series on exploring the way to take full advantage of this kind of hosting, let's see how to deploy a new site to Divshot's servers, while doing most of the work using the command line, for productivity sake.

To get started, you have to sign up to the platform. If you are already using github, it is even quicker, you can just login with your Github account. By the way, the service is free for hosting an unlimited number of sites for development, which is cool for experimenting. You start paying once you want to deploy to production. See the information about the available plans here.

On your development box, install the Divshot Command-Line Interface (aka the CLI) that would allow you to do deployments directly from the command line. First, you need to download and install Node.js following the instructions for your system. After that, install divshot-cli with npm, the Node Package Manager, which comes with Node:

$ npm install -g divshot-cli

At any time, to start interacting with Divshot hosting services, if you are not yet, login from the command line:

$ divshot login

To create a new application on DivShot, for hosting it, for example for a Jekyll-based site, go inside the folder where its code and content are living, and run the init command.

$ cd examplesite
$ divshot init

You'll have to provide the following important information about the application's name, structure and hosting settings:

name: (examplesite) 
root directory: (current) _site
clean urls: (y/n) y
error page: (error.html)
Would you like to create a Divshot.io app from this app?: (y/n) y
...
Creating app ...
Success: examplesite has been created
Success: App initiated

The process will create a divshot.json file that will reside in the root of the application's project directory. You're set!

At any time, if needed, you can adjust the content of the divshot.json file. For our example Jekyll site, the content of the file generated looks like:

{
  "name": "examplesite",
  "root": "_site",
  "clean_urls": true,
  "error_page": "url"
}

When ready, push your code to the DivShot hosted application, simply by using the push command.

$ divshot push

You should be able to visit your application by pointing your browser to http://development.examplesite.divshot.io.

Alternatively, if you do divshot push staging, the site is pushed to http://staging.examplesite.divshot.io. And to push to production, when you are ready and have opted for a paid plan, use divshot push production, and the site will be available on http://examplesite.divshot.io.

comments powered by Disqus

Need help for your project?

Our team can contribute to your project, working on a specific task, or doing all the coding based on your specifications, using Python, a web framework such as Django or a CMS.