DjangoGirls / tutorial

This is a tutorial we are using for Django Girls workshops
http://tutorial.djangogirls.org/
Other
1.53k stars 1.86k forks source link

Need to import `os` module - Spanish tutorial #1763

Closed ijpulidos closed 2 years ago

ijpulidos commented 2 years ago

Issue description

In django_start_project we use the os module when editing the STATIC_ROOT variable in the mysite/settings.py file. But the module itself has never been imported in the file.

This results in a NameError: name 'os' is not defined when creating the database with the command python manage.py migrate in the subsequent steps.

Language

Spanish

Operating system

I tested this on Linux, but it should be failing in all of them.

ijpulidos commented 2 years ago

Of course the solution could be to add instructions to import the os module (that is, import os) in the first few lines of the settings.py file. That said, in other languages they just concatenate the BASE_DIR as in https://github.com/DjangoGirls/tutorial/blob/f2c6ec3190d04f22ac5a79a66c5e3f300a1e0207/en/django_start_project/README.md?plain=1#L106 avoiding the need to use or import the os module.

das-g commented 2 years ago

Hi @ijpulidos

Thanks for notifying us about this problem.

We maintain the translations (i.e., all languages except for English) on Crowdin at https://crowdin.com/project/django-girls-tutorial. As the Spanish translation there is quite out of date (i.e., it only has a partial translation of the current English version), snapshotting it into the GitHub repo and thus publishing it to the live site would break the result even more, as it'd be a mix of translated and untranslated parts.

Help in completing and updating the translation would be highly appreciated.

Have you tested whether the STATIC_ROOT = BASE_DIR / 'static' solution works with the currently published version of the Spanish instructions? If so, as a work-around, let's use that approach and manually put it into the translated files in the GitHub repo, without copying all the rest from Crowdin.

ijpulidos commented 2 years ago

@das-g Yes, using STATIC_ROOT = BASE_DIR / 'static' works!

Are you saying that changing it directly in this repo and making a Pull Request could be enough? Let me know if that's what we want to do. Thanks for the answer!

das-g commented 2 years ago

Are you saying that changing it directly in this repo and making a Pull Request could be enough?

As a quick-fix / workaround, yes. The content of this repo is automatically rendered and published on https://tutorial.djangogirls.org/ by GitHub Actions.

If you're willing to create that PR, please do.