Skip to main content

Introduction

This guide covers deploying Django applications on Shard Cloud. Django is a high-level Python web framework for rapid development.

Creating Your Project

Ensure you have Python and pip installed.

Installing Django

Creating a New Project

Basic Django Application

Create a simple view in myproject/views.py:
myproject/views.py
Update myproject/urls.py:
myproject/urls.py

Settings Configuration

Update myproject/settings.py:

Requirements File

Create a requirements.txt:
requirements.txt

Production Server with Gunicorn

Django’s built-in server is not suitable for production. Always use Gunicorn.

Shard Cloud Configuration

Create a .shardcloud file:
.shardcloud
Run migrations locally before deploying: python manage.py migrate

Deploying

1

Run Migrations Locally

python manage.py migrate python manage.py collectstatic --noinput
2

Prepare Your Files

Ensure you have: - Your Django project folder - requirements.txt - .shardcloud - db.sqlite3 (if using SQLite)
3

Exclude Unnecessary Files

Remove: __pycache__/, venv/, *.pyc
4

Create ZIP Archive

Compress your project folder.
5

Upload to Shard Cloud

Go to Shard Cloud Dashboard and upload.

Additional Resources

Visit the official Django documentation for more information.

Troubleshooting

Add your domain to ALLOWED_HOSTS in settings.py or use ['*'].
Run python manage.py collectstatic before deploying.