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

Issue in setting up local enviornment and running it locally #7

Open
umeshkarthik opened this issue May 14, 2024 · 8 comments
Open

Comments

@umeshkarthik
Copy link

We were trying to setup the application running locally
PS Y:\simpler-grants-pdf-builder\bloom_nofos> poetry run start
Getting the below error

ModuleNotFoundError: No module named 'environ'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "Y:\simpler-grants-pdf-builder\bloom_nofos\manage.py", line 22, in
main()
File "Y:\simpler-grants-pdf-builder\bloom_nofos\manage.py", line 18, in main
execute_from_command_line(sys.argv)
File "C:\Users\ukrajeswaran\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\django\core\management_init_.py", line 442, in execute_from_command_line
utility.execute()
File "C:\Users\ukrajeswaran\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\django\core\management_init_.py", line 436, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "C:\Users\ukrajeswaran\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\django\core\management\base.py", line 426, in run_from_argv
connections.close_all()
File "C:\Users\ukrajeswaran\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\django\utils\connection.py", line 84, in close_all
for conn in self.all(initialized_only=True):
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\ukrajeswaran\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\django\utils\connection.py", line 76, in all
return [
^
File "C:\Users\ukrajeswaran\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\django\utils\connection.py", line 73, in iter
return iter(self.settings)
^^^^^^^^^^^^^
File "C:\Users\ukrajeswaran\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\django\utils\functional.py", line 47, in get
res = instance.dict[self.name] = self.func(instance)
^^^^^^^^^^^^^^^^^^^
File "C:\Users\ukrajeswaran\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\django\utils\connection.py", line 45, in settings
self._settings = self.configure_settings(self.settings)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\ukrajeswaran\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\django\db\utils.py", line 148, in configure_settings
databases = super().configure_settings(databases)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\ukrajeswaran\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\django\utils\connection.py", line 50, in configure_settings
settings = getattr(django_settings, self.settings_name)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\ukrajeswaran\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\django\conf_init
.py", line 89, in getattr
self.setup(name)
File "C:\Users\ukrajeswaran\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\django\conf_init
.py", line 76, in setup
self.wrapped = Settings(settings_module)
^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\ukrajeswaran\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\django\conf_init
.py", line 190, in init
mod = importlib.import_module(self.SETTINGS_MODULE)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.11_3.11.2544.0_x64__qbz5n2kfra8p0\Lib\importlib_init
.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "", line 1204, in _gcd_import
File "", line 1176, in _find_and_load
File "", line 1147, in _find_and_load_unlocked
File "", line 690, in _load_unlocked
File "", line 940, in exec_module
File "", line 241, in _call_with_frames_removed
File "Y:\simpler-grants-pdf-builder\bloom_nofos\bloom_nofos\settings.py", line 16, in
import environ
^^^^^^^^^^^^^^
ModuleNotFoundError: No module named 'environ'

@pcraig3
Copy link
Collaborator

pcraig3 commented May 14, 2024

Hello! Sorry about that, it must be that I have environ installed globally so I didn't notice that it wasn't in the pyproject.toml file.

environ is used in the settings.py file to import env vars. You should be able to use the default environment variables to get everything booted up in dev mode.

This refers to the django-environ package, which is included as one of the deps in the pyproject.toml file. Once you use poetry install, it should be available to you.

Let me know if you have any other problems!

@pcraig3 pcraig3 closed this as completed May 14, 2024
@umeshkarthik
Copy link
Author

umeshkarthik commented May 15, 2024 via email

@pcraig3
Copy link
Collaborator

pcraig3 commented May 15, 2024

Okay, I'll do a clean install of this today and see if I can replicate this and fix it. Will update the issue when I do.

@pcraig3 pcraig3 reopened this May 15, 2024
@umeshkarthik
Copy link
Author

umeshkarthik commented May 15, 2024 via email

@pcraig3
Copy link
Collaborator

pcraig3 commented May 15, 2024

Hi there!

first time setup

I just ran through a clean install on my local environment and updated the README to make the first time setup clearer.

The main change I added is that you need to copy the .env.example file to be a .env file in the bloom_nofos/bloom_nofos folder.

I also added the migration step that you'll need the first time the app is run.

environ missing

I must admit I am confused about this one. Using poetry, you should be able to:

  • clone the repo
  • cd into the main folder
  • poetry install
  • create .env file from .env.example
  • cd bloom_nofos
  • poetry run start

You should also run the migrations but that's all I need to get the app booted up the first time.

import environ in bloom_nofos/bloom_nofos/settings.py actually refers to the django-environ package, which was already in the pyproject.toml file.

Poetry manages your virtualenv for you, so once you do poetry install, you should have all the packages available to you (including django-environ) once you later run poetry run start or poetry run python manage.py runserver. I can't think of a reason why it wouldn't be there.

All I can say is that it worked for me on my Mac. It could be to do with you being on a Windows computer, but I didn't see anything in the issues in the GitHub repo or on Google about Windows causing a problem with django-environ.

could I share the application?

At this time, the NOFO Builder is an internal tool we are using as part of our work with the Health and Human Services department. If you are within the department, we would be happy to follow up about this, but otherwise I'm afraid I can't share the hosting information.

@umeshkarthik
Copy link
Author

umeshkarthik commented May 15, 2024 via email

@apeterson-dmigs
Copy link

hi paul,
i have also been trying to run this service, and i got the server to successfully run. however, i am unsure if it is running in production mode or not. furthermore, if i want to create an account for this, there are no options on the site itself. this it what it looks like:

Screenshot 2024-05-16 152026

in this photo, there is no option to let me sign up and add an account. what is the workaround for this issue?

@pcraig3
Copy link
Collaborator

pcraig3 commented May 16, 2024

Hi @apeterson-dmigs,

Glad to see you got it running. Not addressing how users are created/managed was an oversight in the documentation.

I just pushed an update to the README that explains how to create a superuser account from the command line. (Here's a Django tutorial that explains more about the superuser creation process). Once you have created a user account, you will be able to log in and add more accounts using the admin backend at localhost:8000/admin

The other thing you are likely to need is a NOFO template, unless you already have one. I am not sure how to proceed on this matter — I can't provide one unless you send a formal request through an official channel.

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