Getting DjangoCMS up and running on ActiveState's Stackato

ActiveState has recently started their own PAAS based on CloudFoundry this blog post is to help you get up and running quickly with a Django CMS installation, and hopefully give you enough information to get your own applications on there as well.

To keep things simple, I’ll just go through the steps that are required in order to get this up and running and add some comments along the way. If I missed anything or if you have any questions, please ask in the comments.

Running on Stackato

  1. Register for an account ————————–

Go to http://community.activestate.com/stackato and register for your account. They are currently in beta, and you need to be approved before they will give you access.

  1. Install the client ———————

There are a few different options, follow the steps outlined here. http://docs.stackato.com/quick-start.html#stackato-client-setup

I tried the option where you download the file, and rename it and put it in your path. It wasn’t complicated, but it wasn’t clean either. I chose this option because I didn’t want to install pypm, so I’m not sure if that way is easier or not.

  1. Register your client to the cloud ————————————

Now that you have the client installed you need to tell it which cloud to deploy too. With Stackato, you can run your own local cloud as well as using the sandbox that ActiveState provided. To make things simple, I’m going to use the sandbox. If you want to use the local cloud you will need to read the directions on how to use the local cloud option.

$ stackato target api.sandbox.activestate.com
> Successfully targeted to [https://api.sandbox.activestate.com]
  1. Login to stackato ——————–

Once you point your client in the correct location, you will need to login to the cloud. You can find your login information on your activestate account page. Type the following and answer the questions when prompted.

$ stackato login
> Successfully logged into [https://api.sandbox.activestate.com]
  1. Download this github repo —————————-

To make things easier, I have made a simple django project that has all of the configuration information setup so that you don’t need to do anything if you want to use djangoCMS. Look at my github repo, and see how I did things if you want to get your own application up and running. If you want to use djangoCMS, then all you have to do is follow these steps.

$ cd ~/projects
$ git clone git://github.com/kencochrane/django-cms-stackato.git
$ cd django-cms-stackato
  1. Deploy the project to stackato ———————————

Once you have your application ready, you can push the application to the cloud. When you do this it will prompt you for a bunch of questions, answer them and keep track of what you picked for a website url, because you will need that later. My application is called myblog, but you can put whatever you want, just change myblog with your name.

$ stackato push myblog
  1. Initialize the database (optional) ————————————-

I have set this up so that it should happen automatically at deployment see the stackato.yml file for more details. If you want to run the commands outside of deployments this is what you can do.

$ stackato run myblog python mycms/manage.py syncdb --noinput
  1. Run south migrations (optional) ———————————-

I have set this up so that it should happen automatically at deployment see the stackato.yml file for more details. If you want to run the commands outside of deployments this is what you can do. It is important to note I had to run more then once since it was killed the first time. Maybe it took too long?.

$ stackato run myblog python mycms/manage.py migrate --noinput
  1. Collect the static files (optional) ————————————–

I have set this up so that it should happen automatically at deployment see the stackato.yml file for more details. If you want to run the commands outside of deployments this is what you can do.

$ stackato run myblog python mycms/manage.py collectstatic --noinput
  1. Create the django admin account ———————————–

Now that you have your application installed and you have your database setup, you need to create the django admin, you can do that with ths django management command. Make sure you replace the variables with your values.

$ stackato run myblog python mycms/manage.py createsuperuser --username=admin --email=admin@example.com --noinput
  1. Change the password for the admin user ——————————————

You need to set a password for the admin account so that you can login. Pick a more secure password then the example I have here. (notice it is changepassword2 not changepassword)

$ stackato run myblog python mycms/manage.py changepassword2 admin secret123P@ssw0rd!
  1. Open up the url in your browser ———————————–

When you open up the URL that you picked when you deployed in your browser you should find the DjangoCMS pony welcome page. If not, try debugging using some of the tips below.

Conclusion

That is it, I did all the hard work, so you should be able to follow those simple steps and get djangoCMS up and running in no time. Once you get that working, play around with it, and let me know what you think. Have you tried the other PAAS options yet, if not check those out as well, and then let me know which ones you like better and why. I have written blog posts about most of them at this point, so feel free to check those out (links below), and have fun playing around.

Other Useful Information

Starting an application if it isn’t running

$ stackato start myblog

Restarting an application

$ stackato restart myblog

Stopping an application

$ stackato stop myblog

Updating application after it is already deployed

$ stackato update myblog

Find out how many instances you have running

$  stackato stats myblog

Find out which apps you have installed, and their status

$ stackato apps

Find out what logs you have for your applications

$ stackato files myblog logs

Viewing logs for your app

$ stackato logs myblog --all

Running cat on a particular log file

$ stackato run myblog cat ../logs/myapp-err.log

Links

Update

2/16/2012: Full disclosure. On Feb 16th 2012, I accepted a job with dotCloud a competitor to Stackato. I plan on keeping this blog post up to date and impartial. If you think there are any errors, please let me know in the comments.

Share