> For the complete documentation index, see [llms.txt](https://moluo.gitbook.io/notes/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://moluo.gitbook.io/notes/bian-cheng-xue-xi/python/django/5.1.django-admin.md).

# 5.1.django-admin

创建管理员账号

```bash
$ python manage.py createsuperuser
```

修改管理页面语言及时区

hello\_django/settings.py

```python
...
LANGUAGE_CODE = 'zh-hans'
TIME_ZONE = 'Asia/Shanghai'
USE_TZ = False                   # 若为True，django在数据库存储过程中，就会使用UTC的时间
...
```

将应用注册到管理界面

apps/users/admin.py

```python
from django.contrib import admin

from users.models import UserProfile


class UserProfileAdmin(admin.ModelAdmin):
    pass


admin.site.register(UserProfile, UserProfileAdmin)
```
