Skip to content

Instantly share code, notes, and snippets.

@altherlex
Last active February 27, 2020 19:13
Show Gist options
  • Save altherlex/e464c9242942e07f4c9a691887ae8cf1 to your computer and use it in GitHub Desktop.
Save altherlex/e464c9242942e07f4c9a691887ae8cf1 to your computer and use it in GitHub Desktop.
py commands
$ pg_ctl -D /usr/local/var/postgres stop -s -m fast
$ pg_ctl -D /usr/local/var/postgres start
$ psql
> drop database product;
> create database product;
> \l # list all databases
> \c product #use database
> \d # list all tables
$ pg_restore --username=product --dbname=product -v --no-privileges --no-owner --clean --create ~/Downloads/dev2jan9th.gz
$ python manage.py migrate auth
$ python manage.py createsuperuser
[email protected]
--------------
virtualenv -p python3 venv
virtualenv -p=/usr/local/bin/python3 venv
source venv/bin/activate
deactivate
pip install -r requirements.txt
pip install django===2.0.7
django-admin startproject main .
python manage.py runserver
python manage.py createsuperuser --email [email protected] --username admin
python manage.py makemigrations
python manage.py shell
>>> from registration.models import Remitter
>>> dir(Remitter)
>>> remitter = Remitter.objects.first()
>>> remitter.__dict__
------------
$ ssh [email protected]
product@dev3:~$ docker exec -it productapi bash
----
import os
os.system('python manage.py dumpdata registration --indent 2 -o dump-data-test.txt --database default')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment