Giter VIP home page Giter VIP logo

mysite's Introduction

	Some stuff to remmeber when setting up the tutorial site.

Use python3.2 on command line

python3.2 manage.py runserve

ttp://127.0.0.1:8000/  #for server

python3.2 manage.py syncdb


# to make your own app on same level as manage
python3.2 manage.py startapp polls

#create your model


python3.2 manage.py sql polls

mysql -u root -pqwerty
show databases;

python manage.py validate – Checks for any errors in the construction of your models.
python manage.py sqlcustom polls – Outputs any custom SQL statements (such as table modifications or constraints) that are defined for the application.
python manage.py sqlclear polls – Outputs the necessary DROP TABLE statements for this app, according to which tables already exist in your database (if any).
python manage.py sqlindexes polls – Outputs the CREATE INDEX statements for this app.
python manage.py sqlall polls – A combination of all the SQL from the sql, sqlcustom, and sqlindexes commands.

python3.2 manage.py shell # gives us a django shell to test in

__str__() on Python 3 to your models

# Django provides a rich database lookup API that's entirely driven by
# keyword arguments

to get admin working uncomment the lines in url.py and settings.py

superuser: development password :qwerty

add an admin.py to each app so that admin knows its there.

in admin.py, set list desplay.
useful admin settings:
ist_display

list_filter[]
search_fields
date_hierarchy


django location code:

 python3.2 -c "
import sys
sys.path = sys.path[1:]
import django
print(django.__path__)"


To override a template, just do the same thing you did with base_site.html
 – copy it from the default directory into your custom directory, and make changes.
 
 
 python3.2 manage.py runserver 0.0.0.0:8000
 
 
login:development
pw:qwerty

I had to add the full path for sqllite to work with views '/home/development/aadevelopment/mysite/sqlite.db'

#The render() function takes the request object as its first argument, a template name as its second argument and a dictionary as its optional third argument.  e.g.

return render(request, 'polls/detail.html', {'poll': poll})


#good practice

a separate TestClass for each model or view
a separate test method for each set of conditions you want to test
test method names that describe their function

polls/static/polls/style.css

__end__












mysite's People

Contributors

sumoward avatar

Watchers

James Cloos avatar  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.