Django is a Python framework for creating web applications. This tutorial will show you how to use it on Glitch.
Django can be easily learnt once you learn Python. If you know HTML, CSS, JS etc. you will be able to use them with Django, too.
At first, go to glitch.com, remix any of the starter projects (I recommend hello-express) and delete all files and folders except .env and Assets. Now, open your project terminal and execute the following command-
pip3 install Django
. This will install Django. Now, create your project with
django-admin startproject PROJECT_NAME
in the regular way. Your Django project files have been generated by Django now. Now, create a file called start.sh and add the following code to it:
cd PROJECT_NAME
python3 manage.py runserver
. Notice that we are using Python 3 here. If you want to use Python 2, then you will need Django 1.0 or 1.11.x. Now, you need to go to line 28 of settings.py inside your project directory and add your project’s URL (project-name.glitch.me) and custom domain if you are using one. Congratulations! You can now edit the files as needed. Here is a demo app that shows how your project should look like at this point of time:
https://django-on-glitch.glitch.me
Please note: You may have to run
refresh
in the terminal for the Django project files to show up. You may also need to make a requirements.txt file if you are very unlucky for Glitch to understand that your project is full stack. But remember to keep it empty or Glitch may take a lot of time to start your project.