Personal portfolio site based off of python/django. Built it after taking a few udemy courses. It was quite the experience. Got to get pretty comfortable with django/standardized class based views and more custom function based views. Played with django forms, error handling, custom form styling. Worked a lot with bootstrap styling. I think I can pretty comfortably say I got quite fimiliar with bootstrap. Scoured pretty much every single bootstrap docs page. Also in this personal portfolio project I had the chance to mess with deployment. I deployed the project on digitalocean. The learning curve wasn't very flat to say the least. Had really big issues with getting my static files to load. Kept getting that my static files/css were mime type, whatever that is. Then I just could not figure out how to load environment variables securely. Anyway, it was quite the project.
- Digitalocean Django Deployment How-to
- Used this article the heaviest. For basic setup of the whole project.
- Also in the end very heavy for troubleshooting gunicorn server. Reloading gunicorn stuff, restarting gunicorn server, restarting nginx.
- It was also helpful after nuking PostgreSQL Database to set it backup.
- YouTube Video Following Above Article
- Needed the video to correctly install the existing project dependencies. Digitalocean article just setup new project.
- Harden Security of Production Project
- Ended up not using this one. Did refrence them quite a bit though. They used python-dotenv.
- For some reason python-dotenv would not work for me in production. Kept getting
SECRET_KEY setting must not be empty
.- In Gunicorn server logs it was not empty. Got the right value. On regular logs like when doing
python manage.py migrate
kept getting valueNone
.
- In Gunicorn server logs it was not empty. Got the right value. On regular logs like when doing
- Setting Up Environment Variables in Django
- The path I ended up taking to setup environment variables.
- Used django-environ instead. It worked on the first try in production.
- SSL Securing Nginx on Digitalocean
- Didn't do that yet but will probably end up doing it as the next job on the list.
- Bootstrap Docs
- Used a whole ocean load for bootstrap styling documentation.
- Udemy Django Course with Ajax and Forms Topics
- This course was very helpful in setting up the forms and ajax email form submission.
- Even though I ended up doing the form very differently.
- I had to custom style each individual field.
- All the error handling was custome as well.
- Errors were getting sent as ajax so I wouldn't have to refresh the page each time it errored on submit.
- I did get errors from django but I sent them myself with ajax.
- Article to Setup Email Sending with Django, Digitalocean, Namecheap
- This artical was super helpful to setup everything correctly to send email from my django app
- I'm not sure why I needed to setup the MX and TXT, DNS records on Digitalocea because the message did get sent without them as well.
- This artical was super helpful to setup everything correctly to send email from my django app
- Basic Setup of Email in Django
- Used this artical for setting up the django code for sending an email.
- Forms, Views, Templates, Urls, and some Settings.
- Did not use the email service setup part. I have my own email from namecheap.
- Django Email Docs
- Refered to the docs a bit for the send_mail() function and some other things.
- Secure Nginx Server with Let's Encrypt on Ubuntu Digitalocean
- Everything worked flawlessly. No errors, or hickups whatsoever.
- Automatic Deployment With Github Actions
- The video helped to setup basic workflow.
- I needed to do a lot more configuration as a python/django workflow.
- Gunicorn Service Can't Read Environment Variables
- So this helped in figuring out why gunicorn wasn't reading my env_path environment variable.
- To be honest I'm not a hundred percent sure this was the exact solution or if it was other config stuff I fixed. It works now so it very well might be partially this.
- Multiple Environments With Django-Environ
- This helped to setup the settings file in a way that it worked.
- How to Set Environment Variables in Linux
- Used this as refrence for reading the terminal environment variables like with printenv
- Also for setting environment variables more permenantly
- Run Particular Commands Without Sudo Password In Linux
- Was helpful to make the
sudo systemctl restart gunicorn
command run without password in the github actions workflow.
- Was helpful to make the
- Permission denied to a file I own?
- My .env file seemed to not have permission to be read but it was owned.
- Changed from -rwxrwxr-- to -rwxrwxr-x on the .env file. It worked after doing that.
- Environment Variables Github Docs
- Refrenced these github docs a lot to see how to use environment variables in github actions workflow.
- Django-environ Docs
- Referenced the multiple env files section.
- setup-python V2, Github Repo
- Referenced a lot to see how it worked and how to setup the python/django workflow in github actions with setup-python.
- How to Install Nginx on Ubuntu With Multiple Domains
- I'm hosting 2 sites on one digitalocean droplet. This was a reference to do that correctly.
- How to run multiple self-hosted runners on a single host
- Referenced the blog to correctly run multiple self hosted runners on one digitalocean host.
- Seperate runner for each host individually.
- Making SVG's Responsive with CSS
- The svg files just kept acting wierd. This article helped clear some things up.
- Setting them up as background images.
- Changing image src depending on screen size
- I ended up setting up the svg's as background images to be able to get the specific webpage width breakpoints as media queries.
- How to add a form in a Django detail class based view
- This was the main refrence I used to setup a comment form within the detail view.