I am completely new to Django and profiling. I have completed all the steps mentioned in the document for setting up the silk profiler. https://github.com/jazzband/silk I did not find any error when I ran the manage.py run server command But when I open the browser and call the necessary api, I don't find anything related to silk. I have no idea where to find the results. Any help is greatly appreciated
Just went through the beginning with silk. As a result:
Settings.py:
DEBUG = True
ALLOWED_HOSTS = ['*']
# Application definition
INSTALLED_APPS = [
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'silk',
]
MIDDLEWARE = [
'silk.middleware.SilkyMiddleware',
'django.middleware.security.SecurityMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
]
# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/1.11/howto/static-files/
STATIC_ROOT = os.path.join(os.path.dirname(BASE_DIR), "static_in_env")
#before you change this make sure to create a folder "static" in project directory, otherwise it will throw an error.
STATICFILES_DIRS = [
os.path.join(BASE_DIR, 'static'),
]
STATIC_URL = '/static/'
IN urls.py:
from django.conf.urls import url
from django.contrib import admin
from django.conf.urls import include
urlpatterns = [
url(r'^admin/', admin.site.urls),
url(r'^silk/', include('silk.urls', namespace='silk')),
]
(Assumimg you are on linux)Now run:
python manage.py makemigrations;
python manage.py migrate;
python manage.py collectstatic;
then run the server and go to
127.0.0.1:8000/silk/
url
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With