Rasul Kireev

Indiehacker. Aspiring Data Scientist. Love to try new things. I also write occasionally.

About, Writings, Reading, Now, Learning

Subscribe

This is what learnt the week of July 7, 2019

1. I learnt how to effectively deploy a Django project to a VPS (in my case DigitalOcean Ubuntu 18.04).

Through trial and error I ended up creating two separate settings files (dev.py and prod.py that would be “activated” depending on the environment you are working in (local vs VPS). The annoying thing is that on boot I have to run “export DJANGO_SETTINGS_MODULE = pw.settings.dev” command every single time, for some reason it does not want to save. I guess that would be one additional thing to learn.

It was a pain to move the django project from local to VPS. There are a lot of ways to transfer files apparently (FTP and some others terms that I didn’t want to additionally learn). The first thing that came to my mind was to use GitHub, which I ended up doing, but not without some failures on the way. I learnt to use only one machine (local) to modify files and push the code to GitHub and the other machine (VPS) to only pull the code. I made some errors with the .gitignore file, which I will talk in another point.

2. I learnt to host my static files (css, js, etc) and media files (the ones I upload from the admin panel) on AWS S3 server.


Do not reveal you secret keys to public! I accidentally pushed the .env file that contained my AWS SECRET KEY to GitHub and everybody lost their shit (especially because I only “realised” this on the next day).

The first time I did this because I didn’t know any better. I thought that would be the best way to transfer the file from local to VPS. I had to change everything as I got a ton of message from AWS saying that this is a serious security breach (even got a call asking to read the emails and act quick).

The second time I used a wrong name in the .gitignore file. I wrote .ENV instead of .env. I got another email from AWS instantly asking to change all the Secret keys and passwords, again. (At this point I was starting to trust .gitignore less, even though it was my fault).

Configuring the MEDIA and STATIC settings such that they pull from the correct URL (as well as upload to correct directories/folder when collectstatic is ran). 

3. I learnt how to use pipenv and venv simultaneously on VPS.

I had some permission errors with venv (on my VPS) and tried using pipenv both on my local and VPS. Now, all the dependencies installed as planned, but I had problems with setting up the gunicorn. So what I did was to “freeze” the pipenv dependencies to the requirements file and then using this new file to create a venv in the project folder. That way I had no issues with permissions or gunicorn.



4. How to configure several nginx “buckets” to serve several subdomains on the same server (droplet).


5. The only bulletproof method of getting a job (or anywhere in life for that matter) is to “network”.

“Network” is a stupid word. I mean reaching out to people (on LinkedIn), attending “gatherings” of groups you are interested in (e.g. NYC Python meetups).



6. How to use SASS.

Even though I have figured out how to use it, I am still not entirely sure as to why one would use it. How is it better? (I guess I am not experienced enough with CSS to appreciate the sassiness).


7. How to effectively clean my cast iron skillet.

I leverage the skillet against the sink (at a 45 degree angle), running the warm water stream (High pressure, preferably) and rubbing it with nylon brush. Works like a charm.



8. How to make great chicken (both light and dark) and fish broths.