How to move your project from Linux/Mac to a Linux server using SCP

This is purely for the comparison. My recent post was about the same thing but on Windows. Nasty business. And here is a guide for Linux/Mac – it is so much easier.

The difference is that here I use SCP, and for Windows I used SFTP. That is because even after generating the keys with PuTTYgen I could not figure out how to “install” them into PuTTY to use a command pscp -scp (the PuTTY scp) in the Command Prompt. That and the fact that my teammate was more comfortable with GUIs, so I picked the first thing that worked.

Read More »

Moving Django to a subpath + Nginx + gunicorn (upd. 18.11.21)

upd. I forgot to include the most important line in the Nginx config. Sorry for that. but it does not work for me anymore. I am confused but I am postponing this for a few days to finish top priority tasks.

Super easy, super fun. Let’s base it on this great guide from Digital Ocean.

Say, the subpath you want is /secret/ 👀.

Add it to Nginx config:

server {
    listen 80;
    server_name server_domain_or_IP;

    location /secret/static/ {
        root /home/sammy/myprojectdir;

    location /secret/ {
        rewrite /api(.*) $1 break;   # !!!!!!!!!!!!!! VERY IMPORTANT
        include proxy_params;
        proxy_pass http://unix:/run/gunicorn.sock;

Then, things we will change in

  • in Nginx root means that in the directory it will look for a secret/static/ directory. But now you only have a regular static/.
  • Currently your Django generated static links are all, we will change that too.

Your new settings variables will be something like this:

STATIC_URL = '/secret/static/'
STATIC_ROOT = os.path.join(BASE_DIR, 'secret/static/'

MEDIA_URL = '/secret/media/'
MEDIA_ROOT = os.path.join(BASE_DIR, 'secret/media/'

That’s it. Go check all absolute paths that you wrote down in your project and you are good.