Creating your first site

Installation

Installing and running

The recommended installation method uses Docker. Docker works on OS X, Linux, and Windows, takes care of all the project dependencies (e.g. database, search engine, web server, etc.), and makes Deploying your site easy.

If you’re not ready to use Docker, see Manual Installation.

Otherwise, if you haven’t already, install Docker.

1. Create a new project

$ bash <(curl -Ls https://raw.githubusercontent.com/ic-labs/django-icekit/master/startproject.sh) {project_name}

This will create a new project from the GLAMkit project template, in a directory named {project_name} in the current working directory.

NOTE: Windows users should run this command in Git Bash, which comes with Git for Windows.

Installing the develop branch

The curl command installs the latest release (from the master branch). If you prefer to install the development release (the develop branch), use this:

$ bash <(curl -Ls https://raw.githubusercontent.com/ic-labs/django-icekit/develop/startproject.sh) {project_name} develop

The above command differs from the normal one in two ways. First, it downloads (via curl) the develop version of the script, and second it passes a second argument (“develop”) to the script, which tells it to download the develop versions of all the files it needs when it runs.

2. Run the project

Build a Docker image:

$ cd {project_name}
$ docker-compose build --pull

Run a django container and all of its dependencies:

$ docker-compose run --rm --service-ports django

This will give you a shell inside the Docker container. Create a superuser account:

bash$ manage.py createsuperuser

Run the Django dev server:

bash$ runserver.sh

3. That’s it!

Open the site in a browser:

http://{ my_project }.lvh.me:8000

When you’re done, exit the container and stop all of its dependencies:

bash$ exit
$ docker-compose stop

Next steps

At this point you can get a long way simply by overriding templates and CSS styles. GLAMkit sites are Django projects, and you can add models, views, templates and URLs to your project in much the same way as you would in any Django project.

Where to put your project files

GLAMkit looks for templates in the project root’s templates folder. This is a good place to override 3rd-party templates.

You can create apps in your project as normal, with manage.py startapp.

You may want to create an app named after your project:

manage.py startapp MY_PROJECT_NAME

Having done so, you can put, inside the app:

  • templates in MY_PROJECT_NAME/templates
  • static files in MY_PROJECT_NAME/static - LESS and SCSS files can be compiled to CSS - Javascript files can be compiled to JS
  • templatetags in MY_PROJECT_NAME/templatetags
  • locale-specific date/time format overrides in MY_PROJECT_NAME/formats/
  • URLs in MY_PROJECT_NAME/urls.py
  • etc.