Django Review 1st

Posted on Thu 05 March 2015 in Programming

django installation

  • sudo pip install Django

create a project

  • steps:

    django-admin.py startproject pims
    python manage.py startapp polls
    python manage.py makemigrations polls
    python manage.py sqlmigrate polls 0001
    

try:

python manage.py migrate
python manage.py shell

create a user

python manage.py createsuperuser

testing

  • python -c "import django; print(django.get_version())"
  • python manage.py runserver

faq

  • Projects vs. apps

What’s the difference between a project and an app? An app is a Web application that does something – e.g., a Weblog system, a database of public records or a simple poll app. A project is a collection of configuration and apps for a particular Web site. A project can contain multiple apps. An app can be in multiple projects.

tips of move macports to homebrew

steps:

sudo port -f uninstall installed
sudo rm -rf /opt/local
sudo rm -rf /Applications/DarwinPorts
sudo rm -rf /Applications/MacPorts
sudo rm -rf /Library/LaunchDaemons/org.macports.*
sudo rm -rf /Library/Receipts/DarwinPorts*.pkg
sudo rm -rf /Library/Receipts/MacPorts*.pkg
sudo rm -rf /Library/StartupItems/DarwinPortsStartup
sudo rm -rf /Library/Tcl/darwinports1.0
sudo rm -rf /Library/Tcl/macports1.0
sudo rm -rf ~/.macports