Correct tutorials on evennia startapp use, which seems to have changed with time. Resolve #3287
This commit is contained in:
parent
b4a3bae6a9
commit
8872e00001
3 changed files with 29 additions and 16 deletions
|
|
@ -44,10 +44,11 @@ Here is how you add your own database table/models:
|
|||
|
||||
1. In Django lingo, we will create a new "application" - a subsystem under the main Evennia program. For this example we'll call it "myapp". Run the following (you need to have a working Evennia running before you do this, so make sure you have run the steps in [Setup Quickstart](Getting- Started) first):
|
||||
|
||||
cd mygame/world
|
||||
evennia startapp myapp
|
||||
mv myapp world (linux)
|
||||
move myapp world (windows)
|
||||
|
||||
1. A new folder `myapp` is created. "myapp" will also be the name (the "app label") from now on. We chose to put it in the `world/` subfolder here, but you could put it in the root of your `mygame` if that makes more sense. 1. The `myapp` folder contains a few empty default files. What we are interested in for now is `models.py`. In `models.py` you define your model(s). Each model will be a table in the database. See the next section and don't continue until you have added the models you want.
|
||||
1. A new folder `myapp` is created. "myapp" will also be the name (the "app label") from now on. We move it into the `world/` subfolder here, but you could keep it in the root of your `mygame` if that makes more sense. 1. The `myapp` folder contains a few empty default files. What we are interested in for now is `models.py`. In `models.py` you define your model(s). Each model will be a table in the database. See the next section and don't continue until you have added the models you want.
|
||||
1. You now need to tell Evennia that the models of your app should be a part of your database scheme. Add this line to your `mygame/server/conf/settings.py`file (make sure to use the path where you put `myapp` and don't forget the comma at the end of the tuple):
|
||||
|
||||
```
|
||||
|
|
|
|||
|
|
@ -5,10 +5,16 @@
|
|||
|
||||
In this tutorial we will create a web page that displays the stats of a game character. For this, and all other pages we want to make specific to our game, we'll need to create our own Django "app". We'll call our app `character`, since it will be dealing with character information. From your game dir, run
|
||||
|
||||
cd web
|
||||
evennia startapp character
|
||||
|
||||
This will create a new directory named `character` inside `mygame/web/`. We put it in `web/` to keep things tidy, but you could place it wherever you like. It contains all basic files that a Django app needs.
|
||||
This will create a new directory named `character` inside `mygame`. To keep
|
||||
things tidy, let's move it into the `web/` subdirectory.
|
||||
|
||||
mv character web (linux/mac)
|
||||
move character web (windows)
|
||||
|
||||
We put it in `web/` to keep things tidy, but you could place it wherever you
|
||||
like. It contains all basic files that a Django app needs.
|
||||
|
||||
Note that we will not edit all files in this new directory, many of the generated files are outside the scope of this tutorial.
|
||||
|
||||
|
|
|
|||
|
|
@ -21,9 +21,15 @@ From your game directory, use the following commands:
|
|||
cd web
|
||||
evennia startapp help_system
|
||||
|
||||
This creates a new folder `help_system` in your `mygame/` folder. To keep things
|
||||
tidy, let's move it to the `web/` folder:
|
||||
|
||||
mv help_system web (linux)
|
||||
move help_system web (windows)
|
||||
|
||||
> Note: calling the app "help" would have been more explicit, but this name is already used by Django.
|
||||
|
||||
This will create a directory named `help_system` under `mygame/web/`. We put it there to keep all web-related things together, but you can organize however you like. Here's how the structure looks:
|
||||
We put the new app under `web/`t o keep all web-related things together, but you can organize however you like. Here's how the structure looks:
|
||||
|
||||
mygame/
|
||||
...
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue