15 minutes, Intermediate, Start Building
Learn how to build a blog application with Django and connect it to Astra DB by following along with Tomi's video, located here.
- Signup for DataStax Astra, or login to your already existing account.
- Create an Astra DB Database if you don't already have one.
- Create an Astra DB Keyspace called
sag_tech_blog
in your database. - Generate an Application Token with the role of
Database Administrator
for the Organization that your Astra DB is in. - Click the 'Open in Gitpod' link:
- Once the app is finished launching in the Gitpod IDE, copy the
env.example
file to a file named.env
and fill the required values in from your Application Token and Astra DB connection settings. (The Django settingSECRET_KEY
is unrelated to Astra and can be any alphanumeric string.) - Get your secure connect bundle from the connect page of your database and upload it to your Gitpod instance. Rename it to
bundle.zip
. (To upload the file, drag-and-drop it to the Explorer section of your Gitpod window.) - Create the project tables in Astra DB by running this command in the console:
python manage.py syncdb
- Run the Django project by running this command in the console:
python manage.py runserver
- The app should open in a new browser tab by itself (if it doesn't, check your popup blocker). If you are on Gitpod,
its URL will be something like
https://8000-sapphire-sailfish-wfxezcum.ws-eu18.gitpod.io/
; if you are running locally, openhttp://127.0.0.1:8000/
in your browser instead.
- Work through a video tutorial to build a blog with Django and Astra DB
Follow along in this video tutorial: https://youtu.be/JH24exA7-CA.