Giter Site home page Giter Site logo

django-poll's Introduction

django-poll

learning a bit of django. following along with the getting started demo...

create a project

$ django-admin startproject mysite

$ cd mysite

start the development server

$ python3 manage.py runserver

create the polls app inside the mysite project

$ python3 manage.py startapp polls

add a view

create a urls.py file inside /polls

point the root URLconf at the polls.urls module

database setup

create tables in the database

$ python3 manage.py migrate

create models

run migration

$ python3 manage.py makemigrations polls

check out what SQL the migration would run

$ python3 manage.py sqlmigrate polls 0001

run migrate to create model tables in the database

$ python3 manage.py migrate

remember the three-step guide to making model changes:

  1. change your models (in models.py)
  2. run 'python3 manage.py makemigrations' to create migrations for those changes
  3. run 'python3 manage.py migrate' to apply those changes to the database

create an admin user

$ python3 manage.py createsuperuser admin, [email protected], admin

views

each view is responsible for doing one of two things: returning an HttpResponse object containing the content for the requested page, or raising an exception such as Http404.

reference:

virtual environments

Create a Python3 Virtual Environment: python3 -m venv env

Activate the Virtual Environment: source env/bin/activate

Deactivate the Virtual Environment: deactivate

To Remove a Virtual Environment: sudo em -rf venv

requirements.txt

Automagically create a requirements.txt file: pip3 freeze > requirements.txt

django-poll's People

Contributors

mikeygough avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.