Line 44 is an error: unless you've defined it (you didn't), there is no "write()" - it seems like you took someone's comment too literally: I imagine something like this was said "To save a wiki page, you have to ... um.... save it somehow, you know - print(), or write(), or something!" --- and you put print(), and write() in your code, without understanding why you were doing that.
So - contents of a wikipage which your program is enabling someone to create, must somehow persist between visits.
This can happen any number of ways, and you (basically) choose / decide / design how you will to this.
- a database entry;
- a file
- ...<you fill in the other possibilities, if you like>...
The "magic" you are not grasping is that, in Django, models are Python abstractions (representations) of a database table. You (thankfully) don't have to worry about SQL, or creating a database - just interact with the model, and all the stuff with the backend (be it sqlite, or some other database) is magically translated and done for you.
SO - since you are using django models, you are storing to a database.
That means you don't need to use "print" to put some content in some file (you didn't even connect the content, nor the output destination in your print statement, so that would have been missing anyway);
As for try:/except: --- they need to be in pairs. You put this around something which you think might sometimes fail (like show a page, but the page doesn't exist yet). You try; if anything indented under the "try" fails, the "except" line lists which error names it tries to recover from (that is, you can have more than one except, each trying to recover from a certain kind of error). In the case of view_page(), you do a render to "create" (did you want a redirect instead?). BTW, the last two lines under except need to be out-dented (lines 21-22) - when they are, you will see that you have done "content = page.content" twice in a row: once under the "try" clause, and once again, right after the "try" clause (that is, right after it just succeeded). Pick a place to put this, and have it in one place (I would do it outside the "try").
Hopefully, this gives you a start at understanding what you have, what you are trying to do.
Regards,
Yarko