Mongodb install in mac OS X InstallEasy installing by homebrewbrew install mongodb Make directory for mongodbsudo mkdir -p /data/db and have to give permission to /data/dbsudo chown $USER /data/db Basic settingActivate mongodmongod And access mongodb shell by mongo command backend 2018.04.12
nosql: basic usage of OrientDB OrientDB is kind of NoSQL database. It has several advantages such as Multi-master replication, SQL support and so on.InstallBefore install OrientDB, you need Java. Just go to this Java Download page and download as your os.After install java, just download OrientDB here and unzip the file.Go to orientdb-community-importers-x.x.x/bin/ directory and run server.shsudo ./server.sh Or if you’re usin.. backend 2018.04.10
Django: django channels basic usage I have a chance to make chat service in my company.It’s my first time to make async web by django, so it’s very excited things.I found many chat libraries that support django, but I choolse django channels.It’s well made and well managed library. Also, django channels adopted as an official django project - It did’nt included in django 1.10 for a variety of reasons, but django officially support.. backend/django 2018.04.06
Django: template tag 'now' When want to use now date or datetime in django temlpate, you can pass datetime.now() for context data.But you can simply use now template tag. It displays the current date and/or time, using a format. the time is {% now "jS F Y H:i" %} You can pass predefined ones : DATE_FORMAT, DATETIME_FORMAT, SHORT_DATE_FORMAT, SHORT_DATETIME_FORMAT like this. it is {% now "SHORT_DATE_FORMAT" %} Also you can.. backend/django 2018.04.05
Django: use crontab easy in django - django-crontab InstallInsatll via pippip install django-crontab And add it to INSTALLED_APPSINSTALLED_APPS = ( 'django_crontab', ... ) Make cron.pyCreate cron.py in project directory (same directory as settings.py)def my_scedulaer(): # do sth pass And add CRONJOBS in settings.pyCRONJOBS = [ ('*/5 * * * *', 'myapp.cron.my_scheduled_job'), # also can add args, kwargs ('*/5 * * * *', 'myapp.cron.other_scheduled_j.. backend/django 2018.04.04
Postgres: ubuntu 14.04 에서 password 없이 postgres 접속 sudo -u postgres psql postgres backend/sql (postgres) 2018.04.02
Django: multiple pagination in CBV When using CBV, especially ListView, it’s really easy to make pagination, using paginated_by.But what if you need more than one pagination, or pagination for not a ListView model objects?In ViewsWe can use django Paginator. Just import Paginator, PageNotAnInteger, and EmptyPage and use it.from django.core.paginator import ( Paginator, PageNotAnInteger, EmptyPage, ) ... class MypageView(LoginRequ.. backend/django 2018.03.30
ubuntu 14.04 uwsgi, nginx with django Install virtualenvInstall pip, virtualenv, virtualenvwrappersudo apt-get install -y python-pip python-virtualenv virtualenvwrapper sudo apt-get install python-dev Make virtualenv dirsmkdir ~/virtualenvs Add configure to .bashrcexport WORKON_HOME=~/virtualenvs source /usr/share/virtualenvwrapper/virtualenvwrapper.sh export PIP_VIRTUALENV_BASE=~/virtualenvs Create virtualenvmkvirtualenv mysite wor.. backend/ubuntu 2018.03.29
django: 기본 비밀번호 validation 수정하기 django는 auth 기능을 통해서 강력한 유저/비밀번호 기능을 제공한다. 아이디와 유사한 비밀번호 뿐 아니라 동일한 숫자나 문자, common한 비밀번호 (asdfasdf) 등을 사용하지 못하게 해준다. (is_password_usable()로 확인 가능)이런 강력한 장고 비밀번호 관리는 해당 문서에서 더 자세하게 확인할 수 있다.하지만 이런 기능이 가끔 불편할 때도 있다. 간단한 사이트의 user/password에 장고의 기본 validation을 사용하지 않고 싶을 때가 있는데, 이럴땐 장고 settings의 AUTH_PASSWORD_VALIDATORS를 바꿔주면 된다.기본으로는 다음과 같이 있다.AUTH_PASSWORD_VALIDATORS = [ { 'NAME': 'django.contrib.a.. backend/django 2018.03.22
django: how to know previous page in django Sometimes I need previous page for some reasons.Redirect to previous page after delete object in detail pageRedirect to previous page when login/loggout …You can know previous page with request.Django request has many information with META tag. It has many useful data such as browser information, site domain, and so on.In here, you can check example of request.META headers.This META also has pre.. backend/django 2018.03.18