Re: Best Practices for Django App Packaging
On 01/21/2014 03:45 PM, john.flor...@dart.biz wrote: While I've been packaging Python apps for Fedora for a long time, I'm a complete novice to Django. I've just completed my first app (using the built-in development server) and now want to get it packaged. Thus far I've followed my normal model of using setuptools so that everything very cleanly lands in /usr/lib/python2.7/site-packages/my_package. My Django app is under there, along with other related Python modules that are used independently of the Django app. I'm not finding any docs in the Fedora package guidelines and am unaware of existing packages that might serve as excellent examples. My web searches are turning up lots, but nothing much specific to Fedora. At the moment, I'm particularly struggling with how to make my /etc/httpd/conf.d/myapp.conf point to my /usr/lib/python2.7/site-packages/my_package/my_site/wsgi.py in a good generic RPM spec sense. I'd rather not hard-code the Python version in myapp.conf. Any pointers would be greatly appreciated. If you want an exampple, please look at openstack-dashboard: [1] is the config file to be dropped at /etc/httpd/conf.d (for httpd-2.2) or [2] for httpd-2.4 The spec is here[3] for reference. HTH, Matthias [1] http://pkgs.fedoraproject.org/cgit/python-django-horizon.git/tree/openstack-dashboard.conf [2] http://pkgs.fedoraproject.org/cgit/python-django-horizon.git/tree/openstack-dashboard-httpd-2.4.conf [3] http://pkgs.fedoraproject.org/cgit/python-django-horizon.git/tree/python-django-horizon.spec -- devel mailing list devel@lists.fedoraproject.org https://admin.fedoraproject.org/mailman/listinfo/devel Fedora Code of Conduct: http://fedoraproject.org/code-of-conduct
Re: Best Practices for Django App Packaging
On 01/21/2014 03:45 PM, john.flor...@dart.biz wrote: While I've been packaging Python apps for Fedora for a long time, I'm a complete novice to Django. I've just completed my first app (using the built-in development server) and now want to get it packaged. Thus far I've followed my normal model of using setuptools so that everything very cleanly lands in /usr/lib/python2.7/site-packages/my_package. My Django app is under there, along with other related Python modules that are used independently of the Django app. I'm not finding any docs in the Fedora package guidelines and am unaware of existing packages that might serve as excellent examples. My web searches are turning up lots, but nothing much specific to Fedora. At the moment, I'm particularly struggling with how to make my /etc/httpd/conf.d/myapp.conf point to my /usr/lib/python2.7/site-packages/my_package/my_site/wsgi.py in a good generic RPM spec sense. I'd rather not hard-code the Python version in myapp.conf. Any pointers would be greatly appreciated. If you want an exampple, please look at openstack-dashboard: [1] is the config file to be dropped at /etc/httpd/conf.d (for httpd-2.2) or [2] for httpd-2.4 The spec is here[3] for reference. HTH, Matthias [1] http://pkgs.fedoraproject.org/cgit/python-django-horizon.git/tree/ openstack-dashboard.conf [2] http://pkgs.fedoraproject.org/cgit/python-django-horizon.git/tree/ openstack-dashboard-httpd-2.4.conf [3] http://pkgs.fedoraproject.org/cgit/python-django-horizon.git/tree/ python-django-horizon.spec Thanks Matthias! That's quite a complicated example, although I can see there's much I can learn from it. Unfortunately, it's not the ideal example because it moves everything that setup.py builds into /usr/share/openstack-dashboard. I need to keep stuff under /usr/lib/pythonX.Y/site-packages so that the other, non-Django, parts continue to work as expected. (I suppose I could just relocate the Django-parts of the build, but sounds like it will break more things that it will help.) -- John Florian -- devel mailing list devel@lists.fedoraproject.org https://admin.fedoraproject.org/mailman/listinfo/devel Fedora Code of Conduct: http://fedoraproject.org/code-of-conduct
Re: Best Practices for Django App Packaging
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 01/21/2014 11:22 AM, john.flor...@dart.biz wrote: On 01/21/2014 03:45 PM, john.flor...@dart.biz wrote: While I've been packaging Python apps for Fedora for a long time, I'm a complete novice to Django. I've just completed my first app (using the built-in development server) and now want to get it packaged. Thus far I've followed my normal model of using setuptools so that everything very cleanly lands in /usr/lib/python2.7/site-packages/my_package. My Django app is under there, along with other related Python modules that are used independently of the Django app. I'm not finding any docs in the Fedora package guidelines and am unaware of existing packages that might serve as excellent examples. My web searches are turning up lots, but nothing much specific to Fedora. At the moment, I'm particularly struggling with how to make my /etc/httpd/conf.d/myapp.conf point to my /usr/lib/python2.7/site-packages/my_package/my_site/wsgi.py in a good generic RPM spec sense. I'd rather not hard-code the Python version in myapp.conf. Any pointers would be greatly appreciated. If you want an exampple, please look at openstack-dashboard: [1] is the config file to be dropped at /etc/httpd/conf.d (for httpd-2.2) or [2] for httpd-2.4 The spec is here[3] for reference. HTH, Matthias [1] http://pkgs.fedoraproject.org/cgit/python-django-horizon.git/tree/ openstack-dashboard.conf [2] http://pkgs.fedoraproject.org/cgit/python-django-horizon.git/tree/ openstack-dashboard-httpd-2.4.conf [3] http://pkgs.fedoraproject.org/cgit/python-django-horizon.git/tree/ python-django-horizon.spec Thanks Matthias! That's quite a complicated example, although I can see there's much I can learn from it. Unfortunately, it's not the ideal example because it moves everything that setup.py builds into /usr/share/openstack-dashboard. I need to keep stuff under /usr/lib/pythonX.Y/site-packages so that the other, non-Django, parts continue to work as expected. (I suppose I could just relocate the Django-parts of the build, but sounds like it will break more things that it will help.) Another example you may want to take a look at is ReviewBoard, which is pretty straightforward. http://pkgs.fedoraproject.org/cgit/ReviewBoard.git/tree/ReviewBoard.spec -BEGIN PGP SIGNATURE- Version: GnuPG v1 Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iEYEARECAAYFAlLeu4UACgkQeiVVYja6o6N22QCeJk4+xNa0tciSy4Iu//UaA8mi mNYAoIqoD9BCTI2lXX/LqKO0ikA0CYor =Lsln -END PGP SIGNATURE- -- devel mailing list devel@lists.fedoraproject.org https://admin.fedoraproject.org/mailman/listinfo/devel Fedora Code of Conduct: http://fedoraproject.org/code-of-conduct
Re: Best Practices for Django App Packaging
From: sgall...@redhat.com To: Development discussions related to Fedora devel@lists.fedoraproject.org Date: 01/21/2014 13:24 Subject: Re: Best Practices for Django App Packaging Sent by: devel-boun...@lists.fedoraproject.org -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 01/21/2014 11:22 AM, john.flor...@dart.biz wrote: On 01/21/2014 03:45 PM, john.flor...@dart.biz wrote: While I've been packaging Python apps for Fedora for a long time, I'm a complete novice to Django. I've just completed my first app (using the built-in development server) and now want to get it packaged. Thus far I've followed my normal model of using setuptools so that everything very cleanly lands in /usr/lib/python2.7/site-packages/my_package. My Django app is under there, along with other related Python modules that are used independently of the Django app. I'm not finding any docs in the Fedora package guidelines and am unaware of existing packages that might serve as excellent examples. My web searches are turning up lots, but nothing much specific to Fedora. At the moment, I'm particularly struggling with how to make my /etc/httpd/conf.d/myapp.conf point to my /usr/lib/python2.7/site-packages/my_package/my_site/wsgi.py in a good generic RPM spec sense. I'd rather not hard-code the Python version in myapp.conf. Any pointers would be greatly appreciated. If you want an exampple, please look at openstack-dashboard: [1] is the config file to be dropped at /etc/httpd/conf.d (for httpd-2.2) or [2] for httpd-2.4 The spec is here[3] for reference. HTH, Matthias [1] http://pkgs.fedoraproject.org/cgit/python-django-horizon.git/tree/ openstack-dashboard.conf [2] http://pkgs.fedoraproject.org/cgit/python-django-horizon.git/tree/ openstack-dashboard-httpd-2.4.conf [3] http://pkgs.fedoraproject.org/cgit/python-django-horizon.git/tree/ python-django-horizon.spec Thanks Matthias! That's quite a complicated example, although I can see there's much I can learn from it. Unfortunately, it's not the ideal example because it moves everything that setup.py builds into /usr/share/openstack-dashboard. I need to keep stuff under /usr/lib/pythonX.Y/site-packages so that the other, non-Django, parts continue to work as expected. (I suppose I could just relocate the Django-parts of the build, but sounds like it will break more things that it will help.) Another example you may want to take a look at is ReviewBoard, which is pretty straightforward. http://pkgs.fedoraproject.org/cgit/ReviewBoard.git/tree/ReviewBoard.spec -BEGIN PGP SIGNATURE- Version: GnuPG v1 Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iEYEARECAAYFAlLeu4UACgkQeiVVYja6o6N22QCeJk4+xNa0tciSy4Iu//UaA8mi mNYAoIqoD9BCTI2lXX/LqKO0ikA0CYor =Lsln -END PGP SIGNATURE- Thank you too Stephen! That indeed does look much more similar. Although I don't see any Apache httpd config in the package. Reading The Fine Manual briefly looks like it relies on 'rb-site install' to do this part. I was hoping to find an example where the RPM spec dropped a Django app setup right into /etc/httpd/conf.d -- in other words, a package that just assumes you will use Apache httpd, maybe even creates an empty sqlite db so things are just ready to run with a httpd restart. I may be just trying to do too much in my spec and perhaps should rely on puppet to do the deployment and integration work. -- John Florian -- devel mailing list devel@lists.fedoraproject.org https://admin.fedoraproject.org/mailman/listinfo/devel Fedora Code of Conduct: http://fedoraproject.org/code-of-conduct
Re: Best Practices for Django App Packaging
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 01/21/2014 02:12 PM, john.flor...@dart.biz wrote: From: sgall...@redhat.com To: Development discussions related to Fedora devel@lists.fedoraproject.org Date: 01/21/2014 13:24 Subject: Re: Best Practices for Django App Packaging Sent by: devel-boun...@lists.fedoraproject.org On 01/21/2014 11:22 AM, john.flor...@dart.biz wrote: On 01/21/2014 03:45 PM, john.flor...@dart.biz wrote: While I've been packaging Python apps for Fedora for a long time, I'm a complete novice to Django. I've just completed my first app (using the built-in development server) and now want to get it packaged. Thus far I've followed my normal model of using setuptools so that everything very cleanly lands in /usr/lib/python2.7/site-packages/my_package. My Django app is under there, along with other related Python modules that are used independently of the Django app. I'm not finding any docs in the Fedora package guidelines and am unaware of existing packages that might serve as excellent examples. My web searches are turning up lots, but nothing much specific to Fedora. At the moment, I'm particularly struggling with how to make my /etc/httpd/conf.d/myapp.conf point to my /usr/lib/python2.7/site-packages/my_package/my_site/wsgi.py in a good generic RPM spec sense. I'd rather not hard-code the Python version in myapp.conf. Any pointers would be greatly appreciated. If you want an exampple, please look at openstack-dashboard: [1] is the config file to be dropped at /etc/httpd/conf.d (for httpd-2.2) or [2] for httpd-2.4 The spec is here[3] for reference. HTH, Matthias [1] http://pkgs.fedoraproject.org/cgit/python-django-horizon.git/tree/ openstack-dashboard.conf [2] http://pkgs.fedoraproject.org/cgit/python-django-horizon.git/tree/ openstack-dashboard-httpd-2.4.conf [3] http://pkgs.fedoraproject.org/cgit/python-django-horizon.git/tree/ python-django-horizon.spec Thanks Matthias! That's quite a complicated example, although I can see there's much I can learn from it. Unfortunately, it's not the ideal example because it moves everything that setup.py builds into /usr/share/openstack-dashboard. I need to keep stuff under /usr/lib/pythonX.Y/site-packages so that the other, non-Django, parts continue to work as expected. (I suppose I could just relocate the Django-parts of the build, but sounds like it will break more things that it will help.) Another example you may want to take a look at is ReviewBoard, which is pretty straightforward. http://pkgs.fedoraproject.org/cgit/ReviewBoard.git/tree/ReviewBoard.spec Thank you too Stephen! That indeed does look much more similar. Although I don't see any Apache httpd config in the package. Reading The Fine Manual briefly looks like it relies on 'rb-site install' to do this part. I was hoping to find an example where the RPM spec dropped a Django app setup right into /etc/httpd/conf.d -- in other words, a package that just assumes you will use Apache httpd, maybe even creates an empty sqlite db so things are just ready to run with a httpd restart. I may be just trying to do too much in my spec and perhaps should rely on puppet to do the deployment and integration work. Well, part of the reasoning here is that Django supports sites. First of all, there's no default configuration that will likely ever work, because they need to create a custom Apache configuration for each hostname. Furthermore, you can install multiple different sites on the same machine in different URL paths. Finally, nobody uses SQLite for a real-world deployment (it's not built for that). It's good for development/testing, but it's not a real deployment case. So yes, the real expectation here should be that you deploy the bits you need and configure them with an appropriate tool. -BEGIN PGP SIGNATURE- Version: GnuPG v1 Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iEYEARECAAYFAlLezk0ACgkQeiVVYja6o6PwEwCfZ1OFqYkG+x9WpD1MNalGt3Ky A+gAoKKggtn4GMGuieq2FaxQviKffx+m =WGKD -END PGP SIGNATURE- -- devel mailing list devel@lists.fedoraproject.org https://admin.fedoraproject.org/mailman/listinfo/devel Fedora Code of Conduct: http://fedoraproject.org/code-of-conduct
Re: Best Practices for Django App Packaging
On 01/21/2014 05:22 PM, john.flor...@dart.biz wrote: [1] http://pkgs.fedoraproject.org/cgit/python-django-horizon.git/tree/ openstack-dashboard.conf [2] http://pkgs.fedoraproject.org/cgit/python-django-horizon.git/tree/ openstack-dashboard-httpd-2.4.conf [3] http://pkgs.fedoraproject.org/cgit/python-django-horizon.git/tree/ python-django-horizon.spec Thanks Matthias! That's quite a complicated example, although I can see there's much I can learn from it. Unfortunately, it's not the ideal example because it moves everything that setup.py builds into /usr/share/openstack-dashboard. I need to keep stuff under /usr/lib/pythonX.Y/site-packages so that the other, non-Django, parts continue to work as expected. (I suppose I could just relocate the Django-parts of the build, but sounds like it will break more things that it will help.) Yes, you're right. It's not the ideal and simple example. On the other side, it doesn't matter if you put all that stuff to /usr/share or to %{python_sitelib} Basically, you just need the two files. Stephen had another, more simple example. This gets the job done. For most real world deployments you'd need some more config changes (database, caching, ssl, and more securing). Matthias -- devel mailing list devel@lists.fedoraproject.org https://admin.fedoraproject.org/mailman/listinfo/devel Fedora Code of Conduct: http://fedoraproject.org/code-of-conduct
Re: Best Practices for Django App Packaging
From: mru...@matthias-runge.de To: devel@lists.fedoraproject.org Date: 01/21/2014 15:38 Subject: Re: Best Practices for Django App Packaging Sent by: devel-boun...@lists.fedoraproject.org On 01/21/2014 05:22 PM, john.flor...@dart.biz wrote: [1] http://pkgs.fedoraproject.org/cgit/python-django-horizon.git/tree/ openstack-dashboard.conf [2] http://pkgs.fedoraproject.org/cgit/python-django-horizon.git/tree/ openstack-dashboard-httpd-2.4.conf [3] http://pkgs.fedoraproject.org/cgit/python-django-horizon.git/tree/ python-django-horizon.spec Thanks Matthias! That's quite a complicated example, although I can see there's much I can learn from it. Unfortunately, it's not the ideal example because it moves everything that setup.py builds into /usr/share/openstack-dashboard. I need to keep stuff under /usr/lib/pythonX.Y/site-packages so that the other, non-Django, parts continue to work as expected. (I suppose I could just relocate the Django-parts of the build, but sounds like it will break more things that it will help.) Yes, you're right. It's not the ideal and simple example. On the other side, it doesn't matter if you put all that stuff to /usr/share or to %{python_sitelib} Basically, you just need the two files. Stephen had another, more simple example. This gets the job done. For most real world deployments you'd need some more config changes (database, caching, ssl, and more securing). Matthias Yup, I'm seeing it now. I realize sqlite is normally used for production deployments, but in my case I would have been totally fine with it since I know the number of user connections is always going to be less than 20 or so: one real human on rare occasions and the rest from machines that are almost always going to get a cached page since they're each asking once a minute for their own same page. However, SELinux made me adopt the better practice of using Postgresql since all the policy is there for that. :-) I've got a deployed (test) setup roughly working now. Next step is to clean up the hard to maintain it's fragile aspects. I will probably wind up doing as openstack-dashboard does and moving some of the python package/modules out of /usr/lib/pythonX.Y and into /usr/share/my_app since the rpm spec can do that much smartly. Then my puppet manifests can refer to things that aren't such moving targets. I largely want to avoid a big mess of figuring out how to migrate the deployed instance to new hosts as Fedora releases come out. (As a rule, we never upgrade; just reinstall with much help from puppet. Think of it as a fire drill.) Hopefully I'll get to keep playing with Django in the future so it all doesn't become foreign 6 months from now. Thanks to all for the pointers. They've been a big help. -- John Florian -- devel mailing list devel@lists.fedoraproject.org https://admin.fedoraproject.org/mailman/listinfo/devel Fedora Code of Conduct: http://fedoraproject.org/code-of-conduct