I must obtain a virtual hosting for my django application, however space for storage is quite costly on virtual-hosting, so I must make use of a hosting that is shared provider to keep the media/static content of the site as it is a great deal cheaper. How do i understand this done?



For my application I have to run specialized libraries (e.g. matplotlib) which can't be placed on shared-hosting, therefore I won't have the ability to run Django on shared-hosting using FastCGI.


To clarify the question, I will have to have the ability to upload in django and keep content around the hosting that is shared. This is a quote from the django book in the section Managing a Separate Media Server (link):

This task could be slightly tricky, however. In case your application involves file uploads, Django must have the ability to write submitted media towards the media server. If media endures another server, it's important to arrange a means for your email happen over the network.

But there's no particulars how this is often accomplished.

There is nothing stopping you against pointing your Web addresses in a different host inside your (X)HTML output.

In case your hosting that is shared account sits at, for instance, http://awesome-hosting-provider.com/~myname/, you are able to set MEDIA_URL inside your configurations.py for this value, make certain to make use of RequestContext when rendering and also to have django.core.context_processors.media incorporated in TEMPLATE_CONTEXT_PROCESSORS (note it's inside automatically) and you can only use to prefix your Web addresses in templates.

The admin works with this particular, as lengthy while you copy its needed static files to the shared atmosphere to ensure they are accessible.

Because you should also take proper care of file uploads, because the book states, you will need to have the ability to create towards the storage location (around the shared server) out of your Django deployment. You will find a number of ways of accomplishing this.

The simplest would most likely be to mount the very best-level directory of the storage atmosphere in your virtual server using SSHFS using the right options (like reunite, reasonable timeouts etc.). This involves SSH use of the shared atmosphere, obviously. To create things simpler, establishing a SSH authentication key pair might prove useful.

Alternately, you can test NFS in case your hosting that is shared provider enables you to achieve that, although I've found it improbable as you would expect.

If anything else fails, you will need to setup a webservice of some type in your shared atmosphere that will pay attention to uploads out of your Django deployment making the Django application forward them. Within this situation, however, hou'll need to make certain it's safe enough with no malicious user will have the ability to compromise your storage server by directly speaking into it.