https://github.com/davipythonweb/alliance_one
Aplicação com Django e Django-Rest-Framework + React
https://github.com/davipythonweb/alliance_one
django django-rest-framework python-dotenv react venv-python
Last synced: 2 days ago
JSON representation
Aplicação com Django e Django-Rest-Framework + React
- Host: GitHub
- URL: https://github.com/davipythonweb/alliance_one
- Owner: davipythonweb
- License: mit
- Created: 2024-11-03T19:15:56.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2024-11-06T22:23:44.000Z (about 1 year ago)
- Last Synced: 2025-01-19T14:17:11.335Z (11 months ago)
- Topics: django, django-rest-framework, python-dotenv, react, venv-python
- Language: Python
- Homepage:
- Size: 92.8 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# alliance_one
Aplicação com Django e Django-Rest-Framework + React
### Django
`Fluxo do Django Framework`

- instalar pacote
pip install + nome do pacote
- fazer os testes
python manage.py test
ˋcomandos djangoˋ
- criado projeto
django-admin startproject core .
- rodar projeto
python manage.py runserver
- criando app
python manage.py startapp + nome
- criar as tabelas no banco
python manage.py migrate
- fazendo mudancas e criar os arquivos de migracoes
python manage.py makemigrations
- criando super usuario admin
python manage.py createsuperuser user>admin
- migrando para banco PostgreSQL
`comandos`
`acessar shell postgres (windows)`
- psql -U postgres
`lista todos os bancos`
- \l
`criar banco`
- CREATE DATABASE (nome do banco);
`sair`
- \q
`drive para django e postgres`
- pip install psycopg2
`para usar variaveis de ambient`
- pip install python-dotenv
- configs para testar ADMIN DJANGO
admin
admin@contato.com
Admin$5000
#### React
##### estrutura Minima para projeto com Vite + React
_____________________________
- node_modules
- public
- src
- App.jsx
- main.jsx
- index.html
- packge.json
- packge-lock.json
- vite.config.js
____________________________
* node-version==20.17.0
* npm-version==10.8.2
* react-version==18.3.1
* vite-version==5.4.1
* criar projeto-web com a ferramenta de build/bundler -> vite
`npm create vite@latest .`
`npm install`
`npm run dev`
* gerar arquivos finais para subir no servidor
`npm run build`
- detro de package.json
- "build": "rm -rf ../backend/dist && vite build && mkdir -p ../backend/dist/static && cp -r dist/assets ../backend/dist/static && cp dist/index.html ../backend/dist && rm -rf dist",
* Explicação===>
- O comando vite build cria a pasta dist com os arquivos gerados.
- mkdir -p ../backend/dist/static cria a pasta static dentro do backend, onde os arquivos JavaScript e CSS serão colocados.
- cp -r dist/assets ../backend/dist/static copia a pasta assets para dentro de static.
- cp dist/index.html ../backend/dist copia o index.html para a pasta dist do backend.
- rm -rf dist remove a pasta temporária dist após a cópia.