Serhat Teker

Serhat Teker is the software engineer who wrote these articles.

I created this Tech Blog to help me remember the things I’ve learned in the past, so my future-self doesn’t have to re-learn them in the future.

            

How to Check Django Version

2020-02-11 — One minute
#django  #python  #linux  #unix 
You can use one of the below methods to check which version of Django you installed: Using python bin: $ python -m django –version 3.0.5 Using pip freeze: $ pip freeze asgiref==3.2.7 Django==3.0.5 pytz==2020.1 sqlparse==0.3.1 This method gives you all python packages that you installed. To see only Django: $ pip freeze | grep Django Django==3.0.5 Using pip show: $ pip show django Name: Django Version: 3.

How to Change Last Commit in Git

2020-02-04 — 2 minutes
#git  #vcs  #linux  #unix 
This happens to me if I commit, then run tests or code formatter. Or sometimes I forgot to add some files since I don’t use usual git add . command. I rather to add files one by one explicitly. So how can we change the history? The last commit history? Add File(s) You forgot to add a file, or files into your commit and you want to add them. It is easy:

Rename Local and Remote Git Branch

2020-01-28 — One minute
#git  #vcs  #linux  #unix 
If you mistyped or want to change a branch name, here is the steps you should follow: Rename the local branch to the new name: $ git branch –move <old_branch_name> <new_branch_name> Delete the old branch on the remote: $ git push <remote> –delete <old_branch_name> Push the new branch to remote: $ git push <remote> <new_branch_name> Reset the upstream branch for the new_branch_name local branch

How to Use Email as Username for Django Authentication

2020-01-23 — 4 minutes
#python  #django  #auth 
0: Intro The aim of this post will be explaining how to create a custom User Model in Django. So we can use that email address as the primary ‘user identifier’ instead of a username for authentication. Default Django app will give you a User Model that has a mandatory username field, and an ‘optional’ email field. However if you’re starting a new project, Django highly recommends you to set up a custom User Model.

How to Create SECRET_KEY for Django Settings

2020-01-16 — One minute
#python  #django  #secret  #env 
When you start a django project, django-admin startproject automatically adds a randomly-generated SECRET_KEY to each new project. However if you want to change it, or add a seperate one to each of your environment, e.g: one for ‘production’, one for ‘staging’, one for ‘production’ etc, how do you gerenerate a new ones? There would be another case: you cloned a project from a remote repo and want to change the default SECRET_KEY.