Where is django configuration file my_project.settings

30 views
Skip to first unread message

Martha S

unread,
May 16, 2019, 2:25:42 PM5/16/19
to Arches Project
Since Colin's thread was locked and re-directed, I'm using the same title to respond to his comment regarding my_project.settings. When we reached the same point with the same problem, I examined some of the stack trace. As Colin is doing, I am installing arches on a new machine, not upgrading a machine with an older version.

It appears that giving your project a name other than arches results in some invalid settings in some of the py files. For example, settings.py loads the arches library, but immediately makes calls to modules in the projectname library, which doesn't exist:

import os
import arches
import inspect

try:
    from arches.settings import *
except ImportError:
    pass

APP_ROOT = os.path.dirname(os.path.abspath(inspect.getfile(inspect.currentframe())))
STATICFILES_DIRS =  (os.path.join(APP_ROOT, 'media'),) + STATICFILES_DIRS

DATATYPE_LOCATIONS.append('hpla.datatypes')
FUNCTION_LOCATIONS.append('hpla.functions')



Similarly, wsgi.py, which is the file that generated the error Colin mentioned, fails on the following line:

os.environ['DJANGO_SETTINGS_MODULE'] = "hpla.settings"

I experimented with changing hpla to arches in wsgi.py and got further, but I'm about to scrap everything and re-install the project as arches. I could go through all of the files in the stack trace and replace all 'hpla.' occurrences with 'arches.', but I think it will be easier for long-term maintenance to just go with arches. So long as I can call the production product what I want, I should be fine.


Adam Cox

unread,
May 16, 2019, 2:40:56 PM5/16/19
to Martha S, Arches Project
Hi Martha,

I just unmarked Colin's answer as a duplicate so that I could address the settings question he had. In short, if you are having trouble, I think it must be a different issue; it sounds like his development server was running fine.

Cheers,
Adam

--
-- To post, send email to arches...@googlegroups.com. To unsubscribe, send email to archesprojec...@googlegroups.com. For more information, visit https://groups.google.com/d/forum/archesproject?hl=en
---
You received this message because you are subscribed to the Google Groups "Arches Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email to archesprojec...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/archesproject/e81e3cd8-098a-40fd-bf97-7af64d42b7c2%40googlegroups.com.

Martha S

unread,
May 16, 2019, 3:00:23 PM5/16/19
to Arches Project
My development server is running fine, too, Adam,

This problem surfaces when we try to deploy in Apache.

Martha


On Thursday, May 16, 2019 at 11:40:56 AM UTC-7, Adam Cox wrote:
Hi Martha,

I just unmarked Colin's answer as a duplicate so that I could address the settings question he had. In short, if you are having trouble, I think it must be a different issue; it sounds like his development server was running fine.

Cheers,
Adam

On Thu, May 16, 2019 at 1:25 PM Martha S <marth...@lacity.org> wrote:
Since Colin's thread was locked and re-directed, I'm using the same title to respond to his comment regarding my_project.settings. When we reached the same point with the same problem, I examined some of the stack trace. As Colin is doing, I am installing arches on a new machine, not upgrading a machine with an older version.

It appears that giving your project a name other than arches results in some invalid settings in some of the py files. For example, settings.py loads the arches library, but immediately makes calls to modules in the projectname library, which doesn't exist:

import os
import arches
import inspect

try:
    from arches.settings import *
except ImportError:
    pass

APP_ROOT = os.path.dirname(os.path.abspath(inspect.getfile(inspect.currentframe())))
STATICFILES_DIRS =  (os.path.join(APP_ROOT, 'media'),) + STATICFILES_DIRS

DATATYPE_LOCATIONS.append('hpla.datatypes')
FUNCTION_LOCATIONS.append('hpla.functions')



Similarly, wsgi.py, which is the file that generated the error Colin mentioned, fails on the following line:

os.environ['DJANGO_SETTINGS_MODULE'] = "hpla.settings"

I experimented with changing hpla to arches in wsgi.py and got further, but I'm about to scrap everything and re-install the project as arches. I could go through all of the files in the stack trace and replace all 'hpla.' occurrences with 'arches.', but I think it will be easier for long-term maintenance to just go with arches. So long as I can call the production product what I want, I should be fine.


--
-- To post, send email to arches...@googlegroups.com. To unsubscribe, send email to arches...@googlegroups.com. For more information, visit https://groups.google.com/d/forum/archesproject?hl=en

---
You received this message because you are subscribed to the Google Groups "Arches Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email to arches...@googlegroups.com.

Adam Cox

unread,
May 16, 2019, 3:36:12 PM5/16/19
to Martha S, Arches Project
Ok, are you using this documentation for setting up Apache? https://arches.readthedocs.io/en/stable/serving-arches-with-apache/#setup-apache Now that I'm looking at it, I think the paths in it should be updated to use the my_project context that we use in the main installation instructions. Looks like I originally wrote it as to serve the "core" arches code, not a separate project.

If you are getting errors about importing settings, the first thing to check is that the paths in the python process are correct.

So, this is what I'll be putting in the docs right now for an update:

        WSGIDaemonProcess arches python-path=/home/ubuntu/Projects/my_project:/home/ubuntu/Projects/ENV/lib/python2.7/site-packages
        WSGIScriptAlias /  /home/ubuntu/Projects/my_project/my_project/wsgi.py process-group=arches

I think the key difference here is that the first path in the "python-path" argument is to the directory above my_project/settings.py.

Let me know if that works.

Adam



-- To post, send email to arches...@googlegroups.com. To unsubscribe, send email to archesprojec...@googlegroups.com. For more information, visit https://groups.google.com/d/forum/archesproject?hl=en

---
You received this message because you are subscribed to the Google Groups "Arches Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email to archesprojec...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/archesproject/864e8eb1-89bd-465d-bc3b-ae3f95258131%40googlegroups.com.

Martha S

unread,
May 16, 2019, 6:33:17 PM5/16/19
to Arches Project
Yes, Adam, those were the instructions I followed.

Looks like I have more configuring to do before I can share the link with the programmer, but this change you just recommended opens Arches to the What is Arches page from my desktop. Big step forward, thank you.

Thanks,
Martha

Reply all
Reply to author
Forward
Message has been deleted
0 new messages