Help


Community tutorials and documentations

Deploy your Django application with the Python InstantApp in seconds

Deploy your Django application with the Python InstantApp in seconds

The intended audience of this image is Python developers who want to bootstrap or test a Python application easily, in seconds.

Common packages have been installed:

  • various SCM: git, mercurial, svn
  • system wide dependencies of Python package mysql-python (libmysqlclient-dev, python-dev). You can then run pip install mysql-python.
  • system wide dependencies of Python package psycopg2 (libpq-dev, python-dev). You can then run pip install psycopg2.
  • virtualenv, so you can isolate your development environment

Also, a web environment is bootstrapped so you can deploy your web application easily.

Requirements

  • You have an account and are logged into cloud.scaleway.com
  • You have configured your SSH Key

To understand why this image is useful, let’s deploy a simple Django application.

Step 1 - Create and start a new C1 server using the Python InstantApp

First, we need to create a new server using the Python InstantApp. Click the “Create Server” button in the control panel.

Control Panel

You land on the server creation page where you must input information and choose an image.

Create server basic information

After inputting your server basic information, select the Python image for your server.
On the ImageHub tab, select Python and click the “Create Server” button.

In a few seconds, the server will be started.

Step 2 - Run a Django web application

This image makes it super easy to deploy your Django application, with nginx and uWSGI. The commands below can also be used to deploy another Python web application.

First of all, install Django and create your project:

$> pip install django
$> cd /var/www
$> django-admin startproject my_django_project

Then, enable the nginx template to configure the virtualhost:

$> ln -s /etc/nginx/sites-available/my_website /etc/nginx/sites-enabled/

Also, you need to enable the uWSGI template:

$> ln -s /etc/uwsgi/apps-available/my_django_project.ini /etc/uwsgi/apps-enabled/

Finally, restart services:

$> service uwsgi restart
$> service nginx restart

And you can open your browser and visit your IP to view your super new website!

IMPORTANT you may want to customize the nginx and uWSGI configuration templates we provided! We created these files only to help, because it’s always a pain to setup a web stack.

Useful links:

Conclusion

What's not

This image doesn’t contain databases, because we can’t really know which one you prefer.

To install MySQL, run:

$> apt-get install mysql-server

And/or PostgreSQL:

$> apt-get install postgresql

Suggestions

If you think something is missing in this image, or if it would have been easier if you had this or that tool, or if thisshould be configured that way instead of how it currently is, we'd love to hear from you!

You can make an issue and/or a pull request on github

Discover a new cloud experience

Deploy SSD cloud servers in seconds.