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.
Django 1.7 upgrade error: AppRegistryNotReady: Models aren't loaded yet
You try to reference a model at the import time. It is no longer possible in Django 1.7. Django 1.7 allows you to use your models only after all of the applications are loaded. You should move this call to the ready callback of AppConfig http://stackoverflow.com/questions/25680803/django-1-7-upgrade-error-appregistrynotready-models-arent-loaded-yet
tutorial
virtualenv
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