kopia lustrzana https://github.com/wagtail/wagtail
Improve explanations in getting started tutorial (#9299)
Co-authored-by: Thibaud Colas <thibaudcolas@gmail.com>pull/9307/head
rodzic
6814d0beea
commit
3aefdb87dd
|
@ -630,6 +630,7 @@ Contributors
|
|||
* Adinapunyo Banerjee
|
||||
* Dan Hayden
|
||||
* Jadesola Kareem
|
||||
* Dauda Yusuf
|
||||
|
||||
|
||||
Translators
|
||||
|
|
|
@ -19,13 +19,13 @@
|
|||
|
||||
## Quick install
|
||||
|
||||
Run the following in a virtual environment of your choice:
|
||||
Run the following commands in a virtual environment of your choice:
|
||||
|
||||
```sh
|
||||
$ pip install wagtail
|
||||
```
|
||||
|
||||
(Installing outside a virtual environment may require `sudo`.)
|
||||
(Installing wagtail outside a virtual environment may require `sudo`. sudo is a program to run other programs with the security privileges of another user, by default the superuser)
|
||||
|
||||
Once installed, Wagtail provides a command similar to Django\'s `django-admin startproject` to generate a new site/project:
|
||||
|
||||
|
@ -41,9 +41,9 @@ Inside your `mysite` folder, run the setup steps necessary for any Django projec
|
|||
|
||||
```sh
|
||||
$ pip install -r requirements.txt
|
||||
$ ./manage.py migrate
|
||||
$ ./manage.py createsuperuser
|
||||
$ ./manage.py runserver
|
||||
$ python manage.py migrate
|
||||
$ python manage.py createsuperuser
|
||||
$ python manage.py runserver
|
||||
```
|
||||
|
||||
Your site is now accessible at `http://localhost:8000`, with the admin backend available at `http://localhost:8000/admin/`.
|
||||
|
|
|
@ -12,7 +12,7 @@ or add the package to your existing requirements file. This will also install th
|
|||
|
||||
## Settings
|
||||
|
||||
In your settings file, add the following apps to `INSTALLED_APPS`:
|
||||
In your settings.py file, add the following apps to `INSTALLED_APPS`:
|
||||
|
||||
```python
|
||||
'wagtail.contrib.forms',
|
||||
|
@ -105,14 +105,14 @@ urlpatterns = [
|
|||
|
||||
Note that this only works in development mode (`DEBUG = True`); in production, you will need to configure your web server to serve files from `MEDIA_ROOT`. For further details, see the Django documentation: [Serving files uploaded by a user during development](https://docs.djangoproject.com/en/stable/howto/static-files/#serving-files-uploaded-by-a-user-during-development) and [Deploying static files](https://docs.djangoproject.com/en/stable/howto/static-files/deployment/).
|
||||
|
||||
With this configuration in place, you are ready to run `./manage.py migrate` to create the database tables used by Wagtail.
|
||||
With this configuration in place, you are ready to run `python manage.py migrate` to create the database tables used by Wagtail.
|
||||
|
||||
## User accounts
|
||||
|
||||
Superuser accounts receive automatic access to the Wagtail admin interface; use `./manage.py createsuperuser` if you don't already have one. Custom user models are supported, with some restrictions; Wagtail uses an extension of Django's permissions framework, so your user model must at minimum inherit from `AbstractBaseUser` and `PermissionsMixin`.
|
||||
Superuser accounts receive automatic access to the Wagtail admin interface; use `python manage.py createsuperuser` if you don't already have one. Custom user models are supported, with some restrictions; Wagtail uses an extension of Django's permissions framework, so your user model must at minimum inherit from `AbstractBaseUser` and `PermissionsMixin`.
|
||||
|
||||
## Start developing
|
||||
|
||||
You're now ready to add a new app to your Django project (via `./manage.py startapp` - remember to add it to `INSTALLED_APPS`) and set up page models, as described in [Your first Wagtail site](/getting_started/tutorial).
|
||||
You're now ready to add a new app to your Django project (via `python manage.py startapp` - remember to add it to `INSTALLED_APPS` in your settings.py file) and set up page models, as described in [Your first Wagtail site](/getting_started/tutorial).
|
||||
|
||||
Note that there's one small difference when not using the Wagtail project template: Wagtail creates an initial homepage of the basic type `Page`, which does not include any content fields beyond the title. You'll probably want to replace this with your own `HomePage` class - when you do so, ensure that you set up a site record (under Settings / Sites in the Wagtail admin) to point to the new homepage.
|
||||
|
|
|
@ -35,6 +35,10 @@ This tutorial uses [`venv`](https://docs.python.org/3/tutorial/venv.html), which
|
|||
```doscon
|
||||
> python3 -m venv mysite\env
|
||||
> mysite\env\Scripts\activate.bat
|
||||
|
||||
Or:
|
||||
|
||||
> mysite\env\Scripts\activate
|
||||
```
|
||||
|
||||
**On GNU/Linux or MacOS** (bash):
|
||||
|
@ -74,7 +78,7 @@ $ wagtail start mysite mysite
|
|||
```
|
||||
|
||||
```{note}
|
||||
Generally, in Wagtail, each page type, or content type, is represented by a single app. However, different apps can be aware of each other and access each other's data. All of the apps need to be registered within the `INSTALLED_APPS` section of the `settings` file. Look at this file to see how the `start` command has listed them in there.
|
||||
Generally, in Wagtail, each page type, or content type, is represented by a single app. However, different apps can be aware of each other and access each other's data. All of the apps need to be registered within the `INSTALLED_APPS` section of the `settings.py` file. Look at this file to see how the `start` command has listed them in there.
|
||||
```
|
||||
|
||||
### Install project dependencies
|
||||
|
@ -84,10 +88,8 @@ $ cd mysite
|
|||
$ pip install -r requirements.txt
|
||||
```
|
||||
|
||||
This ensures that you have the relevant versions of
|
||||
Wagtail,
|
||||
Django,
|
||||
and any other dependencies for the project you have just created.
|
||||
This ensures that you have the relevant versions of Wagtail, Django, and any other dependencies for the project you have just created.
|
||||
The `requirements.txt` file contains all the dependencies needed in order to run the project.
|
||||
|
||||
### Create the database
|
||||
|
||||
|
@ -266,7 +268,7 @@ takes a Wagtail Page object as an argument.
|
|||
|
||||
In the Wagtail admin, create a `BlogIndexPage` as a child of the Homepage,
|
||||
make sure it has the slug "blog" on the Promote tab, and publish it.
|
||||
You should now be able to access the url `/blog` on your site
|
||||
You should now be able to access the url `http://127.0.0.1:8000/blog` on your site
|
||||
(note how the slug from the Promote tab defines the page URL).
|
||||
|
||||
Now we need a model and template for our blog posts. In `blog/models.py`:
|
||||
|
|
Ładowanie…
Reference in New Issue