Welcome to Day 12 of our exciting 100 Days of Cloud journey! Today, we're going to create a simple Django "Hello World" application and host it on Serv00. No Git required - we're starting from scratch! Let's dive in and make the cloud echo our greeting! π
Step 1: Create Your Serv00 Account π
- Navigate to serv00.com (remember to check for the actual URL)
- Click "Sign Up" and fill in your details
- Choose the free plan - perfect for our Hello World app!
- Confirm your email and you're in!
Step 2: Get Your Free Domain π
- In your Servo dashboard, look for "Free Domains"
- Choose a domain name (e.g., yourusername.serv00.com)
- Click to activate it - this is where our app will live!
Step 3: Enable Run your own applications π§
In your Servo account settings, under additional services,Enable Run your own applications. This allows you to use custom software on your account.
Step 4: SSH Into Your Server π₯οΈ
Open your terminal and type:
ssh yourusername@sx.serv00.com
Enter your password when prompted. Welcome to your cloud server!
Step 5: Create a Virtual Environment πΏ
mkdir /usr/home/LOGIN/.virtualenvs
cd /usr/home/LOGIN/.virtualenvs
virtualenv django_env -p python3.10
source django_env/bin/activate
You're now in a fresh Python environment, perfect for our project!
Step 6: Install Django π
pip install django
This installs the latest version of Django in your virtual environment.
Step 7: Create Your Django Project π
cd /usr/home/LOGIN/domains/YOURDOMAIN
django-admin startproject helloworld
mv helloworld public_python
cd public_python
This creates a new Django project and moves it to the correct directory.
Step 8: Create a Simple View π
Edit helloworld/views.py:
from django.http import HttpResponse
def hello_world(request):
return HttpResponse("Hello, Cloud World!")
Step 9: Configure URLs π
Edit helloworld/urls.py:
from django.urls import path
from . import views
urlpatterns = [
path('', views.hello_world, name='hello_world'),
]
Step 10: Adjust Settings βοΈ
Edit helloworld/settings.py:
- Set DEBUG = False
- Add your Servo domain to ALLOWED_HOSTS
- Configure STATIC_ROOT = '/usr/home/LOGIN/domains/YOURDOMAIN/public_python/public/'
Step 11: Collect Static Files π¨
python manage.py collectstatic
Step 12: Create passenger_wsgi.py π
In your public_python directory, create passenger_wsgi.py:
import os
import sys
sys.path.append(os.getcwd())
os.environ['DJANGO_SETTINGS_MODULE'] = 'helloworld.settings'
from django.core.wsgi import get_wsgi_application
application = get_wsgi_application()
Step 13: Configure WWW Settings in Servo Panel ποΈ
- Set Python version to 3.10
- Set executable to /usr/home/LOGIN/.virtualenvs/django_env/bin/python
- Set application directory to /usr/home/LOGIN/domains/YOURDOMAIN/public_python
Step 14: Restart Your Application π
devil www YOURDOMAIN restart
Step 15: Visit Your Site π
Open your browser and go to your Servo domain. You should see "Hello, Cloud World!"
Congratulations! You've just deployed your first Django app to the cloud! ππ
Remember, cloud explorers, every great journey begins with a single step - or in our case, a single "Hello World"! This simple app is your launchpad to bigger cloud adventures.
Before we sign off, here's a cloud joke to keep you floating:
Why don't clouds ever wear shoes?
Because they prefer to go barefoot! βοΈπ£
Stay tuned for Day 13, where we'll add more features to our cloud-based greeting. Until then, keep your spirits high and your latency low! πβοΈ
Top comments (0)