Giter Site home page Giter Site logo

python-blog_af8g's Introduction

python-blog

C:\Windows\SysWOW64

pip install virtualenv

virtualenv my_env

my_env\Scripts\activate my_env\Scripts\deactivate

pip install Django==1.8.6 python import django django.VERSION


Start Project


django-admin startproject mysite cd mysite python manage.py migrate python manage.py runserver

/* python manage.py runserver 127.0.0.1:8001 */ go to django wsgi to learn to deploy for production from the root directory mysite

python manage.py startapp blog

pip install pytz python manage.py makemigrations blog python manage.py sqlmigrate blog 0001 python manage.py migrate

python manage.py createsuperuser python manage.py runserver

python manage.py shell from django.contrib.auth.models import User from blog.models import Post user = User.objects.get(username='admin') Post.objects.create(title='One more post',slug='one-more-post',body='Post body.',author=user) <Post: One more post>

Post.title="New Title" all_posts = Post.objects.all() Post.objects.all() --query set Post.objects.filter(publish__year=2018) Post.object.filter(publish__year=2018, author__username='admin') Post.object.filter(publish__year)=2016)
.filter(author__username='admin') .exclude(title__startswith='why') Post.objects.order_by('-title') post = Post.objects.get(id=1) post.delete()

python-blog_af8g's People

Contributors

richey89 avatar dawsonrichey avatar trellixvulnteam 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.