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

No module named error when building project using multiple conf.py files #5

Open
sachin-suresh-rapyuta opened this issue Nov 4, 2022 · 1 comment

Comments

@sachin-suresh-rapyuta
Copy link

I am trying to achieve multisite using this extension (not sure if I got it right by saying multisite, or if it should be multi-project).
Here is my requirement. I need multiple sites for a single project (pointed to single GitHub repo). i.e., After building the project on ReadtheDocs, the URL should look something like this:

  • https:// rtd.com/en/site1/latest
  • https:// rtd.com/en/site2/latest
  • https:// rtd.com/jp/site1/latest (For a translated site)
  • https:// rtd.com/jp/site2/latest (For a translated site)

I have my conf.py file like:

# Define the projects that will share this configuration file.
multiproject_projects = {
    "default":{
        "path": "."

    },
    "site1": {
        "path": "multisites/site1",
        # Set `use_config_file` to false
        # to avoid including the files twice.
        "use_config_file": False,
        "project": "Read the Docs user documentation for site1"
    }
}

current_project  = get_project(multiproject_projects)

# Set all values directly
# -----------------------

if current_project == 'default':
   # File: docs/conf.py
   from conf import *
elif current_project == 'site1':
   # File: docs/multisites/site1/conf.py
   from multisites.site1.conf import *

When I run the below command, I get the following error:

$ PROJECT=site1 make clean html

Configuration error:
There is a programmable error in your configuration file:

Traceback (most recent call last):
  File "/home/sachin/.local/lib/python3.8/site-packages/sphinx/config.py", line 347, in eval_config_file
    exec(code, namespace)
  File "/home/sachin/Workspace/Sootballs/rr_sootballs/internal/rr_pa_amr_docs/docs/conf.py", line 143, in <module>
    from multisites.site1.conf import *
ModuleNotFoundError: No module named 'multisites'

I also tried with: from site1.conf import *

What is the right way to give the path to conf.py?

@stsewd
Copy link
Member

stsewd commented Nov 7, 2022

Hi, can you share your project or the structure of it?

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

2 participants