我是Django和剖析的新手。我已经完成了文档中提到的设置丝绸轮廓仪的所有步骤。 https://github.com/jazzband/silk 运行manage.py run server命令时,我没有发现任何错误 但是当我打开浏览器并打电话给必要的api时,我找不到任何与丝绸有关的东西。我不知道在哪里可以找到结果。非常感谢任何帮助
答案 0 :(得分:2)
刚刚开始用丝绸。 结果:
Settings.py:
body.setTransform(x, y, rotation * MathUtils.degreesToRadians);
IN urls.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/'
(假设你在linux上)现在运行:
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')),
]
然后运行服务器并转到
127.0.0.1:8000/silk/
URL