I used python collectstatic to collect all static files to the STATIC_ROOT that I have set. But it always shows 404 for the static files.

The Django is install inside a docker container together with uWSGI and Nginx.


1. Check the settings

In my


STATIC_URL = '/static/'

STATIC_ROOT = os.path.join(BASE_DIR, 'static')


There is no problems with the settings

2. Check the Nginx

In the site configuration file under this path /etc/nginx/sites-enabled in the container:

upstream django {
    server unix:/opt/django/app.sock;

server {
    listen 80 default_server;
    charset utf-8;
    client_max_body_size 75M;

    location /media  {
        alias /opt/django/persistent/media;  # your Django project's media files - amend as required

    location /static {
        alias /opt/django/volatile/static; # your Django project's static files - amend as required

    location / {
        uwsgi_pass django;
        include /opt/django/uwsgi_params; # the uwsgi_params file you installed

Here I found that the mappings are different from my settings. So just need to either change the mapping in the Nginx, or change the STATIC_ROOT in the settings.

In order to not messing up my webfiles, I chose to change the mapping in the Nginx.

It is quite necessary to read the Dockerfile before using their image.

0. Problems

Since Django is rapidly developed, many tutorials about Django could be out-dated. I am learning Django and found that some commands have beed deprecated but the tutorial didn't update them.
So here I am taking notes for some of the deprecated commmands that I have encountered.

1. Can't use "python validate"

When learning the Django book, you might see this (if it's not updated):

python validate

It returns:

Unknown command: 'validate'
Type ' help' for usage.

Use this instead:

python check

2. Can't use "python sqlall" or "python syncdb"

python sqlall books
python syncdb

It returns:

Unknown command: 'sqlall'
Type ' help' for usage.


Unknown command: 'syncdb'
Type ' help' for usage.

Use this instead:

python makemigrations books
# Returns:
#Migrations for 'books':
#  books/migrations/
#    - Create model Author
#    - Create model Book
#    - Create model Publisher
#    - Add field publisher to book

python migrate
# Returns:
# Operations to perform:
#  Apply all migrations: admin, auth, books, contenttypes, sessions
# Running migrations:
#  Applying books.0001_initial... OK

python sqlmigrate books 0001
# This will return the sql command executed on the mysql server

1. Intro

This post is to take notes about how I set up auto reload Django environment in docker.

I am learning Django recently, but I don't want to install the Django directly on my vps. As you know, the installation of Django will change the environment a lot, which is not friendly for maintenance. So I will try to keep every thing inside a container.

Unfortunately, the author of the docker image didn't make the Django automatically reload when changing the codes. That's why I did the following things.

With the help of Git hook, it is quite easy to realize it automatically. The strategy is shown as the following figure:

Every time when new commit is pushed to the git server, the git hook will deploy the source files to the mapped volume of the container, and also touch a reload.ini file which tells the uwsgi to gracefully reload the codes without restart the container.

Read more »


MiniDLNA is a simple media server software, with the aim of being fully compliant with DLNA/UPnP-AV clients.

MiniDLNA Docker Images

This image is based on Alpine Linux.



docker run -d --name minidlna \
      --net=host \
      -p 8200:8200 \
      -p 1900:1900/udp \
      -v <PATH_TO_MUSIC_DIR>:/opt/Music \
      -v <PATH_TO_VIDEOS_DIR>:/opt/Videos \
      -v <PATH_TO_PICUTRES_DIR>:/opt/Pictures \

If you want to overwrite a config file:

docker run -d --name minidlna \
      --net=host \
      -p 8200:8200 \
      -p 1900:1900/udp \
      -v <PATH_TO_MUSIC_DIR>:/opt/Music \
      -v <PATH_TO_VIDEOS_DIR>:/opt/Videos \
      -v <PATH_TO_PICUTRES_DIR>:/opt/Pictures \
      -v <PATH_TO_CONFIG_DIR>/minidlna.conf:/etc/minidlna.conf \

Problems when build from armhf-alpine

1. Can't find the package: minidlna

Check Build Log

2. Entrypoint should be changed

Previous entrypoint is /usr/sbin/minidlnad -d
After make install, the entrypoint should be changed to /usr/local/sbin/minidlnad -d

1. Intro

Here I introduce a useful plugin that I have searched for long:

This vim plugin can run interactive commands inside a Vim buffer. For example, I need to run python console while using vim. I just need to type this command:
:ConqueTermSplit python

Read more »