June 23, 2018

Django Http Request Meta

A standard Python dictionary containing all available HTTP headers. Available headers depend on the client and server, but here are some examples: request.META.get('HTTP_USER_AGENT') CONTENT_LENGTH – The length of the request body (as a string). CONTENT_TYPE – The MIME type of the request body. HTTP_ACCEPT – Acceptable content types for the response. HTTP_ACCEPT_ENCODING – Acceptable encodings for the response. HTTP_ACCEPT_LANGUAGE – Acceptable languages for the response. HTTP_HOST – The HTTP Host header sent by the client. Read more

June 23, 2018

Django and Mysql in Ubuntu

Install required packages sudo apt-get install python-pip python-dev python-virtualenv mysql-server libmysqlclient-dev Create project and virtualenv mkdir ipinfinity && cd ipinfinity virtualenv venv pip install "django<1.9" mysqlclient Create database in Mysql and change setting in django Change database setting to mysql DATABASES = { 'default': { 'ENGINE': 'django.db.backends.mysql', 'NAME': 'myproject', 'USER': 'myprojectuser', 'PASSWORD': 'password', 'HOST': 'localhost', 'PORT': '', } } Migrate to Mysql and create super user python manage. Read more

© Vijay Ronan 2020