0% found this document useful (0 votes)
46 views1 page

Programação Web - Como Fazer Um Projeto No Pycharm

The document provides instructions for creating a Django project in PyCharm. It includes steps to install Django, create a project directory called "mysite" using django-admin, make and apply migrations, create a superuser, start an app called "teste", configure URLs and settings, create a templates directory and HTML file, add models, and define views to render the template. The overall process outlines how to set up the basic structure and functionality of a Django project and app.

Uploaded by

joaogabascenso
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
46 views1 page

Programação Web - Como Fazer Um Projeto No Pycharm

The document provides instructions for creating a Django project in PyCharm. It includes steps to install Django, create a project directory called "mysite" using django-admin, make and apply migrations, create a superuser, start an app called "teste", configure URLs and settings, create a templates directory and HTML file, add models, and define views to render the template. The overall process outlines how to set up the basic structure and functionality of a Django project and app.

Uploaded by

joaogabascenso
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

Como fazer um projeto no pycharm

pip install django

django-admin startproject mysite .

python manage.py makemigrations

python manage.py migrate

python manage.py createsuperuser

python manage.py startapp teste

mysite/urls.py mysite/settings

from django.contrib import admin INSTALLED_APPS = [

from django.urls import path, include 'django.contrib.admin',

'django.contrib.auth',

urlpatterns = [ 'django.contrib.contenttypes',

path('admin/', admin.site.urls), 'django.contrib.sessions',

path('', include('teste.urls')), 'django.contrib.messages',

] 'django.contrib.staticfiles',

'teste',

criar diretório “templates” dentro de “teste”

criar o file “index.html” dentro de templates e colocar as


coisas teste/models.py

from django.db import models

from django.utils import timezone

teste/urls.py teste/views.py
from django.urls import path class Post(models.Model):
from django.shortcuts
from teste import views import render titulo = models.CharField(max_length=120,
null=False, blank=False)

texto = models.TextField(null=False)
urlpatterns = [ def index(request):
data =
path("", views.index, return render(request,
models.DateTimeField(default=timezone.now)
name="index"), 'index.html',{})

You might also like