Last active
August 29, 2015 14:25
-
-
Save vishnuratheesh/2c307c9e0951e0cef91c to your computer and use it in GitHub Desktop.
django-debug-toolbar
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| rm /usr/local/var/mysql/*.err | |
| cd /usr/local/var/ | |
| ls -l | |
| sudo chown -R mysql:mysql mysql/ | |
| sudo mysql.server start | |
| sudo mysql.server restart | |
| sudo mysql.server stop | |
| sudo mysql_upgrade | |
| sudo mysql.server restart | |
| SUCCESS! :) | |
| mysqladmin -u root password <enter a password> | |
| mysql -u root -p | |
| This creates a user: | |
| mysql> create user 'user'@'localhost' identified by 'password'; | |
| mysql> grant all privileges on * . * to 'user'@'localhost'; | |
| mysql> flush privileges; | |
| This creates a db and assigns a user to it: | |
| mysql> create database `db` character set utf8 collate utf8_general_ci; | |
| mysql> grant all on `db`.* to 'user'; | |
| Note: Its the ` (back-tick) character and not the ' (single-quote), I know... weird. | |
| Before Change settings.py: | |
| python manage.py dumpdata > datadump.json | |
| Change settings.py: | |
| DATABASES = { | |
| 'default': { | |
| 'ENGINE': 'django.db.backends.mysql', | |
| 'NAME': 'db', | |
| 'USER': 'user', | |
| 'PASSWORD': 'password', | |
| 'HOST': '127.0.0.1', | |
| 'PORT': '3306', | |
| } | |
| } | |
| Install python mysql client: | |
| pip install mysqlclient | |
| After changing settings.py: | |
| python manage.py makemigrations <app-name> | |
| python manage.py migrate --fake-initial <app-name> | |
| python manage.py syncdb | |
| python manage.py loaddata datadump.json | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| INSTALLED_APPS = ( | |
| # ... | |
| 'django.contrib.staticfiles', | |
| # ... | |
| 'debug_toolbar', | |
| ) | |
| STATIC_URL = '/static/' | |
| DEBUG_TOOLBAR_PATCH_SETTINGS = False | |
| MIDDLEWARE_CLASSES = ( | |
| # ... | |
| 'debug_toolbar.middleware.DebugToolbarMiddleware', | |
| # ... | |
| ) | |
| INTERNAL_IPS = ('127.0.0.1') | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from django.conf import settings | |
| from django.conf.urls import patterns | |
| if settings.DEBUG: | |
| import debug_toolbar | |
| urlpatterns += patterns('', | |
| url(r'^__debug__/', include(debug_toolbar.urls)), | |
| ) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment