How to Make a Django Project on Glitch

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.

3 Likes

Django can be used for making APIs, right?

I’m sure you could, its like express but for python.

1 Like

Yep. I think you can use Node in a Django project, too. You should just need URL configuration for that. But I am not sure and have never tried this.

The difference is django is a bit more opionated unlike express, it has an ORM and an admin built in and other things

2 Likes

Didn’t know this, thought Django was a front-end framework like React.

I just added this part because it was causing issues for me otherwise. I have also filed a bug report on Glitch help desk.

1 Like

I believe glitch will guess your project is python using the fact that it has a requirements.txt

1 Like

I try this solution , but not wor.
Can you tell me if glitch is available for python frameworks like flask and django?
Thank you.

Python is installed, but it’s kind of old. You can try using older versions of flask and django maybe