Thanks for your help Josh. I ended up getting it to work, but not in the 
way I wanted. I ended up uninstalling the outer package (treating a 
directory of python files as something other than a package just feels 
wrong to me). My circus configuration stayed the same referencing 
"my_proj.wsgi:application". I tried multiple things including setting the 
pythonpath how circus recommends, but it looks like the pythonpath is 
preferring the installed package instead of the one in the current 
directory for some reason.

I guess I can't have my cake and eat it too, but I guess Django projects 
aren't meant to be used this way anyway.

Thanks.

On Thursday, August 6, 2015 at 11:23:08 AM UTC-5, Josh Cartmell wrote:
>
> I haven't used chaussette before, so I'm not sure about that.  It might be 
> helpful to look at the supervisor config that come with Mezzanine and 
> appears to be sort of analgous to what you posted above, 
> https://github.com/stephenmcd/mezzanine/blob/master/mezzanine/project_template/deploy/supervisor.conf.template
>
> In that context proj_app is just the name of the application, and 
> proj_path is the path to the outer directory.  So in the case of what comes 
> with Mezzanine you would run the server with my_proj.wsgi because the 
> working directory is set to the outer my_proj directory.
>
> I do see how making the project an installable package could mess things 
> up a bit, since then the outer my_proj would find the outer my_proj instead 
> of the inner.  Maybe there's a way to reorder the python path, so that the 
> inner my_proj is found first?
>
> On Thu, Aug 6, 2015 at 11:24 AM, David Hoese <[email protected] 
> <javascript:>> wrote:
>
>> Alright, one last question (I hope). I'm upgrade my test server that runs 
>> the same way as the production server and now I think my outer package is a 
>> problem. So same project layout as before, but now I'm running it via 
>> chaussette (via a circus daemon). This requires that I point it to the 
>> import path of the wsgi application, so my configuration file looks like 
>> this:
>>
>> cmd = /some-path/bin/chaussette
>>    --backend=waitress
>>    --fd $(circus.sockets.my-proj-dev)
>>    my_proj.wsgi:application
>> working_dir = /path/to/project/my_proj_pkg_dir/my_proj
>>
>> And that's how I had it for the previous version of mezzanine. When I run 
>> it this way it can't find the wsgi application because it's loading the 
>> "my_proj" package from the environment. If I switch it to 
>> "my_proj.my_proj.wsgi:application" it finds the wsgi application, but then 
>> can't find the settings module. It can't find the settings module because 
>> it's trying to load "my_proj.settings", but I think because of the way it's 
>> imported it needs to be "my_proj.my_proj.settings", but even if I changed 
>> that I'm sure it would cause some problems.
>>
>> So if you've used chaussette before, any ideas? Thanks again.
>>
>> On Thursday, August 6, 2015 at 9:05:22 AM UTC-5, Josh Cartmell wrote:
>>>
>>> Moving the db file got me the first time I upgraded a project, it took 
>>> me a little while to figure that out!
>>>
>>> I'm not sure about those warnings myself, they are probably things that 
>>> will need to be updated in Mezzanine to support Django 1.9.  Probably not 
>>> anything to worry too much about.
>>>
>>> On Thu, Aug 6, 2015 at 9:31 AM, David Hoese <[email protected]> wrote:
>>>
>>>> I update my old environment instead of running from the test 
>>>> environment for "mez4proj" and I also get these warnings when starting 
>>>> runserver:
>>>>
>>>> lib/python3.4/importlib/_bootstrap.py:321: RemovedInDjango19Warning: 
>>>> django.contrib.contenttypes.generic is deprecated and will be removed in 
>>>> Django 1.9. Its contents have been moved to the fields, forms, and admin 
>>>> submodules of django.contrib.contenttypes.
>>>>
>>>> On Thursday, August 6, 2015 at 8:04:37 AM UTC-5, David Hoese wrote:
>>>>>
>>>>> I didn't believe you at first, but then I tried it with the "mez4proj" 
>>>>> project and it put it in the base directory. I have my path information 
>>>>> in 
>>>>> a local_settings.py module and didn't change the PROJECT_ROOT properly. I 
>>>>> had "os.path.dirname(os.path.abspath(__file__))" which is what 
>>>>> "PROJECT_APP_PATH" has now. After changing PROJECT_ROOT to 
>>>>> "os.path.dirname(PROJECT_APP_PATH)" everything seems to be working.
>>>>>
>>>>> Although, I do get 2 warnings that I'm guessing are supposed to happen 
>>>>> given the version of Django that Mezzanine supports:
>>>>>
>>>>>  lib/python3.4/site-packages/django/template/base.py:825: 
>>>>> RemovedInDjango19Warning: `request.REQUEST` is deprecated, use 
>>>>> `request.GET` or `request.POST` instead.
>>>>>   current = getattr(current, bit)
>>>>>
>>>>> And:
>>>>>
>>>>> lib/python3.4/site-packages/django/core/handlers/wsgi.py:126: 
>>>>> RemovedInDjango19Warning: `MergeDict` is deprecated, use `dict.update()` 
>>>>> instead.
>>>>>   self._request = datastructures.MergeDict(self.POST, self.GET)
>>>>>
>>>>> Any idea if these are expected? Thanks for all your help.
>>>>>
>>>>> On Wednesday, August 5, 2015 at 8:16:55 PM UTC-5, Josh Cartmell wrote:
>>>>>>
>>>>>> Hi David, glad you sorted the first problem!
>>>>>>
>>>>>> The db file should be in the outer my_proj directory.  Try moving it 
>>>>>> there and maybe that will just fix it.
>>>>>>
>>>>>> If not, I would compare the paths section of your settings.py with 
>>>>>> the one that comes in a default mezzanine 4 project, 
>>>>>> https://github.com/stephenmcd/mezzanine/blob/master/mezzanine/project_template/project_name/settings.py#L160.
>>>>>>   
>>>>>> My guess is that something is off in there that's causing it to look in 
>>>>>> the 
>>>>>> wrong place.
>>>>>>
>>>>>> Good luck!
>>>>>>
>>>>>> On Wed, Aug 5, 2015 at 7:18 PM, David Hoese <[email protected]> wrote:
>>>>>>
>>>>>>> Another related question, on my development machine I am using 
>>>>>>> sqlite3 and had "dev.db" as the name of my DB. This created it in the 
>>>>>>> root 
>>>>>>> directory. Now that settings.py is put in the project app directory it 
>>>>>>> creates the dev.db there. It doesn't seem to work properly with a 
>>>>>>> relative 
>>>>>>> path "../dev.db", but does work with an absolute path. Should relative 
>>>>>>> paths work?
>>>>>>>
>>>>>>>
>>>>>>> On Wednesday, August 5, 2015 at 6:11:00 PM UTC-5, David Hoese wrote:
>>>>>>>>
>>>>>>>> Hi Josh,
>>>>>>>>
>>>>>>>> I answered your questions below, but then realized that my 
>>>>>>>> "my_proj" project app didn't have an __init__.py. After realizing how 
>>>>>>>> things are supposed to work I changed my INSTALLED_APPS to use 
>>>>>>>> "field_experiments" instead of the "my_proj.field_experiments" I was 
>>>>>>>> using. 
>>>>>>>> I had to change a few other things too. I'm getting pages not found 
>>>>>>>> now 
>>>>>>>> from the database so I need to track that down, but I think for the 
>>>>>>>> original problem it's solved. Thanks.
>>>>>>>>
>>>>>>>> See my original answers below:
>>>>>>>>
>>>>>>>>
>>>>>>>>> Are there two copies of field_experiments right now?  The error 
>>>>>>>>> message seems to imply that you have 
>>>>>>>>> my_proj/my_proj/field_experiments/models.py and 
>>>>>>>>> my_proj/field_experiments.'
>>>>>>>>>
>>>>>>>>> In the code there is only that one "field_experiments" directory. 
>>>>>>>> That duplicate that it's talking about I think is because it is 
>>>>>>>> finding the 
>>>>>>>> "field_experiments" directory relative to the manage.py (or current 
>>>>>>>> directory) and its finding the installed package 
>>>>>>>> "my_proj.field_experiments".
>>>>>>>>  
>>>>>>>>
>>>>>>>>> How is field_experiements referenced in your INSTALLED_APPS?
>>>>>>>>>
>>>>>>>>
>>>>>>>> I kept it the same as I had which was " 
>>>>>>>>
>>>>>>>>>
>>>>>>>>> You're layout looks right and is similar to what I did in the blog 
>>>>>>>>> post, in that case moving theme out of the project app.  As long as 
>>>>>>>>> it 
>>>>>>>>> isn't in the inner my_proj you shouldn't have an issue.
>>>>>>>>>
>>>>>>>>> Did you update your manage.py or are you using the same one you've 
>>>>>>>>> had all along?
>>>>>>>>>
>>>>>>>>
>>>>>>>>> For reference I think this is the old manage.py, 
>>>>>>>>> https://github.com/stephenmcd/mezzanine/blob/3a336635ff24de2d451a5f0bf88a3da365f23ffd/mezzanine/project_template/manage.py,
>>>>>>>>>  
>>>>>>>>> and the new one is 
>>>>>>>>> https://github.com/stephenmcd/mezzanine/blob/master/mezzanine/project_template/manage.py
>>>>>>>>>
>>>>>>>>>
>>>>>>>> I'm using the new manage.py and at first it was using "my_proj" as 
>>>>>>>> the project name, but I got an error (ImportError: No module named 
>>>>>>>> 'my_proj.settings') because it was finding the installed package first 
>>>>>>>> instead of the one in the current directory. I then changed it to 
>>>>>>>> "my_proj.my_proj" which points to the correct location, the project 
>>>>>>>> app.
>>>>>>>>  
>>>>>>>>
>>>>>>>>> What is currently in my_proj/my_proj?
>>>>>>>>>
>>>>>>>>
>>>>>>>> templates/
>>>>>>>> local_settings.py
>>>>>>>> settings.py
>>>>>>>> urls.py
>>>>>>>> wsgi.py
>>>>>>>>
>>>>>>>> So from what I can tell, having the outer directory installed as a 
>>>>>>>> package in my python environment is causing all the problems. It seems 
>>>>>>>> like 
>>>>>>>> manage.py and everything related is finding the outer "my_proj" 
>>>>>>>> package 
>>>>>>>> instead of the current directory's "my_proj" project app directory. 
>>>>>>>>
>>>>>>>>
>>>>>>>>> On Wed, Aug 5, 2015 at 5:28 PM, David Hoese <[email protected]> 
>>>>>>>>> wrote:
>>>>>>>>>
>>>>>>>>>> I'm fairly new to Mezzanine and Django and I'm having trouble 
>>>>>>>>>> with moving my old layout to the new layout. I'm following this blog 
>>>>>>>>>> post 
>>>>>>>>>> that was linked to here earlier, 
>>>>>>>>>> http://bitofpixels.com/blog/upgrading-to-mezzanine-4/. I usually 
>>>>>>>>>> have all my python code in python packages so I originally had my 
>>>>>>>>>> mezzanine 
>>>>>>>>>> project in a python package that I could install...even if it was 
>>>>>>>>>> from a 
>>>>>>>>>> git clone.
>>>>>>>>>>
>>>>>>>>>> My old layout:
>>>>>>>>>>
>>>>>>>>>> my_proj_pkg_dir
>>>>>>>>>> setup.py
>>>>>>>>>> my_proj
>>>>>>>>>> __init__.py
>>>>>>>>>> settings.py
>>>>>>>>>> field_experiments  # custom django app
>>>>>>>>>> urls.py
>>>>>>>>>> wsgi.py
>>>>>>>>>> manage.py
>>>>>>>>>> ...
>>>>>>>>>>
>>>>>>>>>> My new layout that I'm trying to do:
>>>>>>>>>>
>>>>>>>>>> my_proj_pkg_dir
>>>>>>>>>> setup.py
>>>>>>>>>> my_proj
>>>>>>>>>> __init__.py
>>>>>>>>>> my_proj # mezz project app
>>>>>>>>>> field_experiments # custom django app
>>>>>>>>>> manage.py
>>>>>>>>>> ...
>>>>>>>>>>
>>>>>>>>>> From what I understand django now loads things from the "project 
>>>>>>>>>> app" instead of from the directory so since I have the "my_proj" 
>>>>>>>>>> package I 
>>>>>>>>>> made it conflicts with the "my_proj" project application. So I get 
>>>>>>>>>> errors 
>>>>>>>>>> when it accesses the models like:
>>>>>>>>>>
>>>>>>>>>> RuntimeError: Conflicting 'experiment' models in application 
>>>>>>>>>> 'field_experiments': <class 
>>>>>>>>>> 'my_proj.field_experiments.models.Experiment'> 
>>>>>>>>>> and <class 'field_experiments.models.Experiment'>.
>>>>>>>>>>
>>>>>>>>>> So I think my options are to either move the field_experiments 
>>>>>>>>>> app outside of the project dir and make it its own package or stop 
>>>>>>>>>> making/installing the my_proj package. If someone could provide me 
>>>>>>>>>> with 
>>>>>>>>>> some guidance it would be much appreciated. Thanks in advance.
>>>>>>>>>>
>>>>>>>>>> -- 
>>>>>>>>>> You received this message because you are subscribed to the 
>>>>>>>>>> Google Groups "Mezzanine Users" group.
>>>>>>>>>> To unsubscribe from this group and stop receiving emails from it, 
>>>>>>>>>> send an email to [email protected].
>>>>>>>>>> For more options, visit https://groups.google.com/d/optout.
>>>>>>>>>>
>>>>>>>>>
>>>>>>>>> -- 
>>>>>>> You received this message because you are subscribed to the Google 
>>>>>>> Groups "Mezzanine Users" group.
>>>>>>> To unsubscribe from this group and stop receiving emails from it, 
>>>>>>> send an email to [email protected].
>>>>>>> For more options, visit https://groups.google.com/d/optout.
>>>>>>>
>>>>>>
>>>>>> -- 
>>>> You received this message because you are subscribed to the Google 
>>>> Groups "Mezzanine Users" group.
>>>> To unsubscribe from this group and stop receiving emails from it, send 
>>>> an email to [email protected].
>>>> For more options, visit https://groups.google.com/d/optout.
>>>>
>>>
>>> -- 
>> You received this message because you are subscribed to the Google Groups 
>> "Mezzanine Users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to [email protected] <javascript:>.
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Mezzanine Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to