Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
C
CRUD_Animais_da_Fazenda
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
7
Issues
7
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Hiago Rafael
CRUD_Animais_da_Fazenda
Commits
07c54d6f
Commit
07c54d6f
authored
Apr 16, 2026
by
bricioso
Browse files
Options
Browse Files
Download
Plain Diff
teste o BD
parents
4f56c48e
df75709c
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
15 deletions
+8
-15
app.py
Python/app.py
+5
-15
models.py
Python/models.py
+3
-0
No files found.
Python/app.py
View file @
07c54d6f
...
@@ -8,27 +8,16 @@ app.config['SQLALCHEMY_TRACK_MODIFICATIONS'] = False
...
@@ -8,27 +8,16 @@ app.config['SQLALCHEMY_TRACK_MODIFICATIONS'] = False
db
.
init_app
(
app
)
db
.
init_app
(
app
)
with
app
.
app_context
():
with
app
.
app_context
():
db
.
create_all
()
db
.
create_all
()
# Isso cria o arquivo database.db pra você!
# 1. ROTA DE LOGIN (Agora o site começa aqui!)
@app.route
(
'/'
)
@app.route
(
'/'
)
def
login
():
return
render_template
(
'login.html'
)
# 2. ROTA DO CATÁLOGO (Onde as pessoas veem as ofertas)
@app.route
(
'/catalogo'
)
def
index
():
def
index
():
animais
=
Animal
.
query
.
all
()
animais
=
Animal
.
query
.
all
()
return
render_template
(
'lista.html'
,
animais
=
animais
)
return
render_template
(
'lista.html'
,
animais
=
animais
)
# 3. ROTAS DE CADASTRO (Ajustadas para os nomes dos seus arquivos)
@app.route
(
'/cadastro'
)
@app.route
(
'/cadastro_animal'
)
def
cadastro
():
def
cadastro_animal
():
return
render_template
(
'cadastro.html'
)
return
render_template
(
'cadastro_animal.html'
)
@app.route
(
'/cadastro_pessoa'
)
def
cadastro_pessoa
():
return
render_template
(
'cadastro_pessoa.html'
)
if
__name__
==
'__main__'
:
if
__name__
==
'__main__'
:
app
.
run
(
debug
=
True
)
app
.
run
(
debug
=
True
)
\ No newline at end of file
Python/models.py
View file @
07c54d6f
from
flask_sqlalchemy
import
SQLAlchemy
db
=
SQLAlchemy
()
class
Animal
(
db
.
Model
):
class
Animal
(
db
.
Model
):
__tablename__
=
'animais'
__tablename__
=
'animais'
id
=
db
.
Column
(
db
.
Integer
,
primary_key
=
True
)
id
=
db
.
Column
(
db
.
Integer
,
primary_key
=
True
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment