This code will set-up a Django Project with tailwindCSS and daisyUI ready to be deployed to Heroku.
This template was created alongside this blogpost
To set-up the project from scratch, run the following commands in your terminal.
git clone https://github.com/kenshuri/django_tailwind_heroku.git
cd django_tailwind_heroku
python -m virtualenv venv
pip install -r requirements.txt
cd jstoolchains
npm install
You're good to go my friend!
To see your project in action, open 2 terminals.
In the first terminal run:
cd django_tailwind_heroku
cd jstoolchains
npm run tailwind-watch
In the second terminal run:
cd django_tailwind_heroku
python manage.py runserver
As prompted, open the page http://127.0.0.1:8000/ and enjoy 🚀
Note that changes in your html template blogApp\templates\blogApp\index.html
automatically updates what you see in your browser.
heroku create -a your-app-name-on-heroku
git remote -v
To make sure that your app can be accessed, you need to add your app domain on Heroku to the list of allowed hosts.
Please change the setting in your settings.py
file to match your app name on Heroku.
# settings.py
ALLOWED_HOSTS = ['127.0.0.1', 'your-app-name-on-heroku.herokuapp.com']
Now commit the change:
git commit blogProject\settings.py -m 'Modify allowed hosts'
git push heroku main
Finally, add the 2 following environment variables to your Heroku app (in Settings > Config Vars):
get_random_secret_key