Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve tutorial installation #699

Open
CedricRaison opened this issue Jun 23, 2024 · 11 comments
Open

Improve tutorial installation #699

CedricRaison opened this issue Jun 23, 2024 · 11 comments

Comments

@CedricRaison
Copy link

Hello,

The documentation for setting up a Django Unicorn project is not very clear. I was following the installation process: https://www.django-unicorn.com/docs/installation/

Here are the issues I encountered:

  1. The first small issue is that it asks to install django-unicorn without first instructing to install and set up a Django project. It should specify this beforehand.

  2. The second issue is that it's not very clear how to set up the template. Here is the documentation:

3. Add {% load unicorn %} to the top of the Django HTML template.

4. Add {% unicorn_scripts %} into the Django HTML template and make sure there is a {% csrf_token %} in the template as well.
<!-- index.html -->
{% load unicorn %}
<html>
  <head>
    {% unicorn_scripts %}
  </head>
  <body>
    {% csrf_token %}
  </body>
</html>

But where is this supposed to be placed? Should I create an empty Django project with django startapp application_name, create a templates folder inside it, and add an index.html inside? Should I create an "empty" view that will show this template? What about the startunicorn command? Should it be a different app? If yes, what is the purpose of creating a Django app just for an index.html file?

I'm just following the tutorial, and I think it should be clearer on how to install and set up a Django Unicorn project.

I'm sorry to create issue like this but I think it could really help newcomer like me to the project.

Thank you.

@CedricRaison
Copy link
Author

That would be great if you know how to startup a django-unicorn project

@CedricRaison
Copy link
Author

It would be a lot better to improve the official documentation so every one can benefit from it.

@CedricRaison
Copy link
Author

Do it yourself if you know how to improve it. I cannot because I don't understand how to setup a django-unicorn project but if I could I would have made the PR myself.

@tataraba
Copy link

I was talking to @adamghill hill about this recently and I think you make a good point here about making the documentation a little clearer as to how to get started. I may work on this, but probably not till next week. I appreciate the examples you've given above, and if you have any other thoughts, feel free to drop them in here and I'll see if I can address those.

@adamghill
Copy link
Owner

@CedricRaison I really appreciate that you created this issue! I agree that the documentation should be more clear -- it currently makes a lot of assumptions. We'll be tackling this soon and we'll update this issue when there is something to check out. 👍

@tataraba
Copy link

@adamghill I'm thinking of adding a "Getting Started" section.

I was able to build docs locally to test some things, but one thing I was thinking of adding is collapsible/dropdown sections for basic items (installing python, creating django project, etc...)

I found out that to do that, I would need to add the a the sphinx extension sphinx-design

I tried to add that using poetry into the "docs" group, but got an error:

The current project's supported Python range (>=3.8,<4) is not compatible with some of the required packages Python requirement:
  - sphinx-design requires Python >=3.9, so it will not be satisfied for Python >=3.8,<3.9

I can keep going without those neat documentation things, but just wanted to bring this up. (This also would enable those tabbed groupings for things like different installation instructions, etc...)

@adamghill
Copy link
Owner

Oh, for tabbed groupings I was looking at https://github.com/pradyunsg/sphinx-inline-tabs. Let me see what I can do about sphinx-design, though.

@adamghill
Copy link
Owner

@tataraba

  1. I added this in pyproject.toml:
sphinx-design = { version = "*", optional = true }
  1. I added "sphinx-design" to the docs extras group in pyproject.toml
  2. Ran poetry lock && poetry install --extras docs --extras minify in the terminal and it seemed to work

Can you try that and see what happens for you?

@tataraba
Copy link

Okay, I was able to add sphinx-design with the instructions above...

Still got error during the build phase (can't recognize directive type: dropdown), but that may be user error there. I'll play around with it a bit more and let you know if I have any other issues.

@adamghill
Copy link
Owner

Not sure if you added it to the extensions, but maybe that's why? https://sphinx-design.readthedocs.io/en/latest/get_started.html#usage

@tataraba
Copy link

Yeah, I was missing that, but also had to add myst_enable_extensions = ["colon_fence"]

I added both to conf.py and now it's working locally for me. That should get me on my way. Hopefully should have something for you to look at tomorrow (I know it's late there 😁

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants