-
Notifications
You must be signed in to change notification settings - Fork 0
/
configuracoes.txt
56 lines (46 loc) · 1.58 KB
/
configuracoes.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#Instalar postgres (Mac)
brew install postgresql@11
Se necessário: initdb --locale=C -E UTF-8 /usr/local/var/postgres
#Instalar postgres (Windows)
https://www.postgresql.org/download/windows/
set path para : "C:\Program Files\PostgreSQL\10\bin"
#criar
createuser pfe (mac)
createuser -U postgres -P -s -e pfe (windows)
createdb pfe (mac)
createdb -U postgres pfe (windows)
#starta servidor
brew services start postgresql@11
# Mostra mensagens de erro
postgres -D /usr/local/var/postgres
# Atualiza base de dados (se necessário)
brew postgresql-upgrade-database
# Backup dbbackup
psql -U pfe -h 127.0.0.1 -d pfe (psql -U Username -h 127.0.0.1 -d DatabaseName)
\l (para listas bancos de dados)
\q (sai do terminal)
dropdb pfe [dropdb DatabaseName (linha de comando)]
createdb pfe [createdb DatabaseName (linha de comando)]
git clone https://github.com/lpsoares/pfe
(atualizar settings.py)
python3 manage.py makemigrations
python3 manage.py migrate
(python3 manage.py migrate --fake)
python3 manage.py dbrestore
python3 manage.py mediarestore -z
# Backup pelo postgres
pg_dump -U pfe pfe -h localhost > backup.sql
dropdb pfe
createdb pfe
psql -U pfe -h localhost < backup.sql
# Backup pelo Django (para windows soh consegui assim)
python3 manage.py dumpdata --natural-primary --natural-foreign > dump.json
python3 manage.py flush --no-input
python3 manage.py loaddata dump.json
# Virtual environment
source ./env/bin/activate
# outros
brew install rabbitmq
brew services start rabbitmq
~/opt/anaconda3/envs/pfe/bin/celery -A pfe worker -l info &
~/opt/anaconda3/envs/pfe/bin/celery -A pfe beat -l info &