How Do I Package a Django Website for Debian (Not a Python Package or Egg)?

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP












2















I have been searching for the last two weeks and chased myself into multiple dead ends trying to figure out the path that takes me where I want to go. However I finally have to admit that my answer isn't clearly posted anywhere, and here we are.



I'll start off my clarifying: I don't want to build a redistributable Django "App" which seems to mean "plugin" - This isn't a python plugin, it's a full fledged website with an FCGI server, /etc/init.d script, config file in /etc/djangoapps and a requirements.txt for the plugins my site uses.



I want to build a deb package to allow me to deploy to a Dev and Prod server from a build server (I'm using Bamboo, but Jenkins should be the same principle.)



I also want to do this on Debian 7 Wheezy, not Ubuntu. PKGME Seems to do the job on Ubuntu and Debian 8, however it fails to install in a functional state in Wheezy, and I was unable to find a way to fix it.



So I went with trying setuptools, stdeb, and debuild to create my package, which causes me to wind up with an egg, inside a deb, that does not contain any of my /etc or /usr files.



So what is the proper method here?










share|improve this question
























  • digitalocean.com/community/tutorials/…

    – PersianGulf
    Sep 4 '14 at 12:08











  • Uhm, I was hoping you had some magical answer here but this is irrelevant in several ways. 1. It has nothing to with packaging. 2. Its dealing with Django-CMS and not the Django framework. 3. Its covering how to setup and start building a Django-CMS based website, and Im trying to deploy an already coded Django based website.

    – Routhinator
    Sep 4 '14 at 12:12











  • deb packages aren't typically designed to install stuff in user space, which is what you are going for here. so you might not get much help from packaging tools. Debian of course supports python apps/libraries, but this isn't exactly what you have here. having said that, there is no reason you can't make a deb in a more manual way. just use debhelper/dh (dh is generally recommended these days) and say where you want the files to go. Perhaps state clearly in your question where you want your files to live? You'll probably want your plugins to be packages too, of course.

    – Faheem Mitha
    Sep 4 '14 at 13:10
















2















I have been searching for the last two weeks and chased myself into multiple dead ends trying to figure out the path that takes me where I want to go. However I finally have to admit that my answer isn't clearly posted anywhere, and here we are.



I'll start off my clarifying: I don't want to build a redistributable Django "App" which seems to mean "plugin" - This isn't a python plugin, it's a full fledged website with an FCGI server, /etc/init.d script, config file in /etc/djangoapps and a requirements.txt for the plugins my site uses.



I want to build a deb package to allow me to deploy to a Dev and Prod server from a build server (I'm using Bamboo, but Jenkins should be the same principle.)



I also want to do this on Debian 7 Wheezy, not Ubuntu. PKGME Seems to do the job on Ubuntu and Debian 8, however it fails to install in a functional state in Wheezy, and I was unable to find a way to fix it.



So I went with trying setuptools, stdeb, and debuild to create my package, which causes me to wind up with an egg, inside a deb, that does not contain any of my /etc or /usr files.



So what is the proper method here?










share|improve this question
























  • digitalocean.com/community/tutorials/…

    – PersianGulf
    Sep 4 '14 at 12:08











  • Uhm, I was hoping you had some magical answer here but this is irrelevant in several ways. 1. It has nothing to with packaging. 2. Its dealing with Django-CMS and not the Django framework. 3. Its covering how to setup and start building a Django-CMS based website, and Im trying to deploy an already coded Django based website.

    – Routhinator
    Sep 4 '14 at 12:12











  • deb packages aren't typically designed to install stuff in user space, which is what you are going for here. so you might not get much help from packaging tools. Debian of course supports python apps/libraries, but this isn't exactly what you have here. having said that, there is no reason you can't make a deb in a more manual way. just use debhelper/dh (dh is generally recommended these days) and say where you want the files to go. Perhaps state clearly in your question where you want your files to live? You'll probably want your plugins to be packages too, of course.

    – Faheem Mitha
    Sep 4 '14 at 13:10














2












2








2








I have been searching for the last two weeks and chased myself into multiple dead ends trying to figure out the path that takes me where I want to go. However I finally have to admit that my answer isn't clearly posted anywhere, and here we are.



I'll start off my clarifying: I don't want to build a redistributable Django "App" which seems to mean "plugin" - This isn't a python plugin, it's a full fledged website with an FCGI server, /etc/init.d script, config file in /etc/djangoapps and a requirements.txt for the plugins my site uses.



I want to build a deb package to allow me to deploy to a Dev and Prod server from a build server (I'm using Bamboo, but Jenkins should be the same principle.)



I also want to do this on Debian 7 Wheezy, not Ubuntu. PKGME Seems to do the job on Ubuntu and Debian 8, however it fails to install in a functional state in Wheezy, and I was unable to find a way to fix it.



So I went with trying setuptools, stdeb, and debuild to create my package, which causes me to wind up with an egg, inside a deb, that does not contain any of my /etc or /usr files.



So what is the proper method here?










share|improve this question
















I have been searching for the last two weeks and chased myself into multiple dead ends trying to figure out the path that takes me where I want to go. However I finally have to admit that my answer isn't clearly posted anywhere, and here we are.



I'll start off my clarifying: I don't want to build a redistributable Django "App" which seems to mean "plugin" - This isn't a python plugin, it's a full fledged website with an FCGI server, /etc/init.d script, config file in /etc/djangoapps and a requirements.txt for the plugins my site uses.



I want to build a deb package to allow me to deploy to a Dev and Prod server from a build server (I'm using Bamboo, but Jenkins should be the same principle.)



I also want to do this on Debian 7 Wheezy, not Ubuntu. PKGME Seems to do the job on Ubuntu and Debian 8, however it fails to install in a functional state in Wheezy, and I was unable to find a way to fix it.



So I went with trying setuptools, stdeb, and debuild to create my package, which causes me to wind up with an egg, inside a deb, that does not contain any of my /etc or /usr files.



So what is the proper method here?







debian python packaging django






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Sep 4 '14 at 12:05







Routhinator

















asked Sep 4 '14 at 11:55









RouthinatorRouthinator

8611




8611












  • digitalocean.com/community/tutorials/…

    – PersianGulf
    Sep 4 '14 at 12:08











  • Uhm, I was hoping you had some magical answer here but this is irrelevant in several ways. 1. It has nothing to with packaging. 2. Its dealing with Django-CMS and not the Django framework. 3. Its covering how to setup and start building a Django-CMS based website, and Im trying to deploy an already coded Django based website.

    – Routhinator
    Sep 4 '14 at 12:12











  • deb packages aren't typically designed to install stuff in user space, which is what you are going for here. so you might not get much help from packaging tools. Debian of course supports python apps/libraries, but this isn't exactly what you have here. having said that, there is no reason you can't make a deb in a more manual way. just use debhelper/dh (dh is generally recommended these days) and say where you want the files to go. Perhaps state clearly in your question where you want your files to live? You'll probably want your plugins to be packages too, of course.

    – Faheem Mitha
    Sep 4 '14 at 13:10


















  • digitalocean.com/community/tutorials/…

    – PersianGulf
    Sep 4 '14 at 12:08











  • Uhm, I was hoping you had some magical answer here but this is irrelevant in several ways. 1. It has nothing to with packaging. 2. Its dealing with Django-CMS and not the Django framework. 3. Its covering how to setup and start building a Django-CMS based website, and Im trying to deploy an already coded Django based website.

    – Routhinator
    Sep 4 '14 at 12:12











  • deb packages aren't typically designed to install stuff in user space, which is what you are going for here. so you might not get much help from packaging tools. Debian of course supports python apps/libraries, but this isn't exactly what you have here. having said that, there is no reason you can't make a deb in a more manual way. just use debhelper/dh (dh is generally recommended these days) and say where you want the files to go. Perhaps state clearly in your question where you want your files to live? You'll probably want your plugins to be packages too, of course.

    – Faheem Mitha
    Sep 4 '14 at 13:10

















digitalocean.com/community/tutorials/…

– PersianGulf
Sep 4 '14 at 12:08





digitalocean.com/community/tutorials/…

– PersianGulf
Sep 4 '14 at 12:08













Uhm, I was hoping you had some magical answer here but this is irrelevant in several ways. 1. It has nothing to with packaging. 2. Its dealing with Django-CMS and not the Django framework. 3. Its covering how to setup and start building a Django-CMS based website, and Im trying to deploy an already coded Django based website.

– Routhinator
Sep 4 '14 at 12:12





Uhm, I was hoping you had some magical answer here but this is irrelevant in several ways. 1. It has nothing to with packaging. 2. Its dealing with Django-CMS and not the Django framework. 3. Its covering how to setup and start building a Django-CMS based website, and Im trying to deploy an already coded Django based website.

– Routhinator
Sep 4 '14 at 12:12













deb packages aren't typically designed to install stuff in user space, which is what you are going for here. so you might not get much help from packaging tools. Debian of course supports python apps/libraries, but this isn't exactly what you have here. having said that, there is no reason you can't make a deb in a more manual way. just use debhelper/dh (dh is generally recommended these days) and say where you want the files to go. Perhaps state clearly in your question where you want your files to live? You'll probably want your plugins to be packages too, of course.

– Faheem Mitha
Sep 4 '14 at 13:10






deb packages aren't typically designed to install stuff in user space, which is what you are going for here. so you might not get much help from packaging tools. Debian of course supports python apps/libraries, but this isn't exactly what you have here. having said that, there is no reason you can't make a deb in a more manual way. just use debhelper/dh (dh is generally recommended these days) and say where you want the files to go. Perhaps state clearly in your question where you want your files to live? You'll probably want your plugins to be packages too, of course.

– Faheem Mitha
Sep 4 '14 at 13:10











1 Answer
1






active

oldest

votes


















0














A .deb file obviously can install files under /etc and /usr, otherwise your Debian 7 system could not be installed in the first place using such files, so that is the way to go.



Your problems seem to come from the tools you are using in trying to achieve the task, either you use them in the wrong way, or their "easy-of-use" hides capabilities of the .deb based packages that you need to achieve your task.



A .deb file is just an ar archive that contains 3 files: a version number file and two tar archives (usually compressed). It is easy to unpack with a few commands (ar x ... resp. tar xvf ..) and put together again (
tar cvzf ... resp. ar mc ....). Please note that the `debian_version file has to be first to be moved into the archive.



When I have to make .deb packages I start from an existing package that already does part of what I need and add/change the things as necessary.



More detailed information is of course available if you need to understand how the installers execute the various special scripts that can be in the packages, as well as adding dependencies.






share|improve this answer























  • I'm using tools because this is intended for a CI build server. No user intervention is possible and the process must be able to be fully automated. I've found several ways to do this for C applications and Java applications and Django 'apps' which are a form a Python module but not for python webapps. Setuptools is a step in the right direction but i need to change the final output so its not packaging a python egg. This answer is not incorrect but absolutely not what applicable to what Im looking fir.

    – Routhinator
    Sep 4 '14 at 13:01











  • @Routh The commands are trivial and easily put into a script. Try the whole thing out from the commandline and then put them in the script like you would do for calling debuild, stdeb. It is unlikely that those commands are available on your server and tar/ar are not.

    – Anthon
    Sep 4 '14 at 13:11











  • How do I generate a .changes file for upload to a local repository with your method? All my reading has lead me to debuild for this reason.

    – Routhinator
    Sep 4 '14 at 13:17











  • The beauty is that you don't need a .changes file, you just put your new and/or updated files in the extracted directories and put them together again.

    – Anthon
    Sep 4 '14 at 13:28












  • The problem i ran into with my original packaging solution is that the reporistory application refuses to accept a package without a changes file.. Thats how I startwd down this road.

    – Routhinator
    Sep 4 '14 at 13:30











Your Answer








StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "106"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);













draft saved

draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f153737%2fhow-do-i-package-a-django-website-for-debian-not-a-python-package-or-egg%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









0














A .deb file obviously can install files under /etc and /usr, otherwise your Debian 7 system could not be installed in the first place using such files, so that is the way to go.



Your problems seem to come from the tools you are using in trying to achieve the task, either you use them in the wrong way, or their "easy-of-use" hides capabilities of the .deb based packages that you need to achieve your task.



A .deb file is just an ar archive that contains 3 files: a version number file and two tar archives (usually compressed). It is easy to unpack with a few commands (ar x ... resp. tar xvf ..) and put together again (
tar cvzf ... resp. ar mc ....). Please note that the `debian_version file has to be first to be moved into the archive.



When I have to make .deb packages I start from an existing package that already does part of what I need and add/change the things as necessary.



More detailed information is of course available if you need to understand how the installers execute the various special scripts that can be in the packages, as well as adding dependencies.






share|improve this answer























  • I'm using tools because this is intended for a CI build server. No user intervention is possible and the process must be able to be fully automated. I've found several ways to do this for C applications and Java applications and Django 'apps' which are a form a Python module but not for python webapps. Setuptools is a step in the right direction but i need to change the final output so its not packaging a python egg. This answer is not incorrect but absolutely not what applicable to what Im looking fir.

    – Routhinator
    Sep 4 '14 at 13:01











  • @Routh The commands are trivial and easily put into a script. Try the whole thing out from the commandline and then put them in the script like you would do for calling debuild, stdeb. It is unlikely that those commands are available on your server and tar/ar are not.

    – Anthon
    Sep 4 '14 at 13:11











  • How do I generate a .changes file for upload to a local repository with your method? All my reading has lead me to debuild for this reason.

    – Routhinator
    Sep 4 '14 at 13:17











  • The beauty is that you don't need a .changes file, you just put your new and/or updated files in the extracted directories and put them together again.

    – Anthon
    Sep 4 '14 at 13:28












  • The problem i ran into with my original packaging solution is that the reporistory application refuses to accept a package without a changes file.. Thats how I startwd down this road.

    – Routhinator
    Sep 4 '14 at 13:30















0














A .deb file obviously can install files under /etc and /usr, otherwise your Debian 7 system could not be installed in the first place using such files, so that is the way to go.



Your problems seem to come from the tools you are using in trying to achieve the task, either you use them in the wrong way, or their "easy-of-use" hides capabilities of the .deb based packages that you need to achieve your task.



A .deb file is just an ar archive that contains 3 files: a version number file and two tar archives (usually compressed). It is easy to unpack with a few commands (ar x ... resp. tar xvf ..) and put together again (
tar cvzf ... resp. ar mc ....). Please note that the `debian_version file has to be first to be moved into the archive.



When I have to make .deb packages I start from an existing package that already does part of what I need and add/change the things as necessary.



More detailed information is of course available if you need to understand how the installers execute the various special scripts that can be in the packages, as well as adding dependencies.






share|improve this answer























  • I'm using tools because this is intended for a CI build server. No user intervention is possible and the process must be able to be fully automated. I've found several ways to do this for C applications and Java applications and Django 'apps' which are a form a Python module but not for python webapps. Setuptools is a step in the right direction but i need to change the final output so its not packaging a python egg. This answer is not incorrect but absolutely not what applicable to what Im looking fir.

    – Routhinator
    Sep 4 '14 at 13:01











  • @Routh The commands are trivial and easily put into a script. Try the whole thing out from the commandline and then put them in the script like you would do for calling debuild, stdeb. It is unlikely that those commands are available on your server and tar/ar are not.

    – Anthon
    Sep 4 '14 at 13:11











  • How do I generate a .changes file for upload to a local repository with your method? All my reading has lead me to debuild for this reason.

    – Routhinator
    Sep 4 '14 at 13:17











  • The beauty is that you don't need a .changes file, you just put your new and/or updated files in the extracted directories and put them together again.

    – Anthon
    Sep 4 '14 at 13:28












  • The problem i ran into with my original packaging solution is that the reporistory application refuses to accept a package without a changes file.. Thats how I startwd down this road.

    – Routhinator
    Sep 4 '14 at 13:30













0












0








0







A .deb file obviously can install files under /etc and /usr, otherwise your Debian 7 system could not be installed in the first place using such files, so that is the way to go.



Your problems seem to come from the tools you are using in trying to achieve the task, either you use them in the wrong way, or their "easy-of-use" hides capabilities of the .deb based packages that you need to achieve your task.



A .deb file is just an ar archive that contains 3 files: a version number file and two tar archives (usually compressed). It is easy to unpack with a few commands (ar x ... resp. tar xvf ..) and put together again (
tar cvzf ... resp. ar mc ....). Please note that the `debian_version file has to be first to be moved into the archive.



When I have to make .deb packages I start from an existing package that already does part of what I need and add/change the things as necessary.



More detailed information is of course available if you need to understand how the installers execute the various special scripts that can be in the packages, as well as adding dependencies.






share|improve this answer













A .deb file obviously can install files under /etc and /usr, otherwise your Debian 7 system could not be installed in the first place using such files, so that is the way to go.



Your problems seem to come from the tools you are using in trying to achieve the task, either you use them in the wrong way, or their "easy-of-use" hides capabilities of the .deb based packages that you need to achieve your task.



A .deb file is just an ar archive that contains 3 files: a version number file and two tar archives (usually compressed). It is easy to unpack with a few commands (ar x ... resp. tar xvf ..) and put together again (
tar cvzf ... resp. ar mc ....). Please note that the `debian_version file has to be first to be moved into the archive.



When I have to make .deb packages I start from an existing package that already does part of what I need and add/change the things as necessary.



More detailed information is of course available if you need to understand how the installers execute the various special scripts that can be in the packages, as well as adding dependencies.







share|improve this answer












share|improve this answer



share|improve this answer










answered Sep 4 '14 at 12:54









AnthonAnthon

61.4k17107170




61.4k17107170












  • I'm using tools because this is intended for a CI build server. No user intervention is possible and the process must be able to be fully automated. I've found several ways to do this for C applications and Java applications and Django 'apps' which are a form a Python module but not for python webapps. Setuptools is a step in the right direction but i need to change the final output so its not packaging a python egg. This answer is not incorrect but absolutely not what applicable to what Im looking fir.

    – Routhinator
    Sep 4 '14 at 13:01











  • @Routh The commands are trivial and easily put into a script. Try the whole thing out from the commandline and then put them in the script like you would do for calling debuild, stdeb. It is unlikely that those commands are available on your server and tar/ar are not.

    – Anthon
    Sep 4 '14 at 13:11











  • How do I generate a .changes file for upload to a local repository with your method? All my reading has lead me to debuild for this reason.

    – Routhinator
    Sep 4 '14 at 13:17











  • The beauty is that you don't need a .changes file, you just put your new and/or updated files in the extracted directories and put them together again.

    – Anthon
    Sep 4 '14 at 13:28












  • The problem i ran into with my original packaging solution is that the reporistory application refuses to accept a package without a changes file.. Thats how I startwd down this road.

    – Routhinator
    Sep 4 '14 at 13:30

















  • I'm using tools because this is intended for a CI build server. No user intervention is possible and the process must be able to be fully automated. I've found several ways to do this for C applications and Java applications and Django 'apps' which are a form a Python module but not for python webapps. Setuptools is a step in the right direction but i need to change the final output so its not packaging a python egg. This answer is not incorrect but absolutely not what applicable to what Im looking fir.

    – Routhinator
    Sep 4 '14 at 13:01











  • @Routh The commands are trivial and easily put into a script. Try the whole thing out from the commandline and then put them in the script like you would do for calling debuild, stdeb. It is unlikely that those commands are available on your server and tar/ar are not.

    – Anthon
    Sep 4 '14 at 13:11











  • How do I generate a .changes file for upload to a local repository with your method? All my reading has lead me to debuild for this reason.

    – Routhinator
    Sep 4 '14 at 13:17











  • The beauty is that you don't need a .changes file, you just put your new and/or updated files in the extracted directories and put them together again.

    – Anthon
    Sep 4 '14 at 13:28












  • The problem i ran into with my original packaging solution is that the reporistory application refuses to accept a package without a changes file.. Thats how I startwd down this road.

    – Routhinator
    Sep 4 '14 at 13:30
















I'm using tools because this is intended for a CI build server. No user intervention is possible and the process must be able to be fully automated. I've found several ways to do this for C applications and Java applications and Django 'apps' which are a form a Python module but not for python webapps. Setuptools is a step in the right direction but i need to change the final output so its not packaging a python egg. This answer is not incorrect but absolutely not what applicable to what Im looking fir.

– Routhinator
Sep 4 '14 at 13:01





I'm using tools because this is intended for a CI build server. No user intervention is possible and the process must be able to be fully automated. I've found several ways to do this for C applications and Java applications and Django 'apps' which are a form a Python module but not for python webapps. Setuptools is a step in the right direction but i need to change the final output so its not packaging a python egg. This answer is not incorrect but absolutely not what applicable to what Im looking fir.

– Routhinator
Sep 4 '14 at 13:01













@Routh The commands are trivial and easily put into a script. Try the whole thing out from the commandline and then put them in the script like you would do for calling debuild, stdeb. It is unlikely that those commands are available on your server and tar/ar are not.

– Anthon
Sep 4 '14 at 13:11





@Routh The commands are trivial and easily put into a script. Try the whole thing out from the commandline and then put them in the script like you would do for calling debuild, stdeb. It is unlikely that those commands are available on your server and tar/ar are not.

– Anthon
Sep 4 '14 at 13:11













How do I generate a .changes file for upload to a local repository with your method? All my reading has lead me to debuild for this reason.

– Routhinator
Sep 4 '14 at 13:17





How do I generate a .changes file for upload to a local repository with your method? All my reading has lead me to debuild for this reason.

– Routhinator
Sep 4 '14 at 13:17













The beauty is that you don't need a .changes file, you just put your new and/or updated files in the extracted directories and put them together again.

– Anthon
Sep 4 '14 at 13:28






The beauty is that you don't need a .changes file, you just put your new and/or updated files in the extracted directories and put them together again.

– Anthon
Sep 4 '14 at 13:28














The problem i ran into with my original packaging solution is that the reporistory application refuses to accept a package without a changes file.. Thats how I startwd down this road.

– Routhinator
Sep 4 '14 at 13:30





The problem i ran into with my original packaging solution is that the reporistory application refuses to accept a package without a changes file.. Thats how I startwd down this road.

– Routhinator
Sep 4 '14 at 13:30

















draft saved

draft discarded
















































Thanks for contributing an answer to Unix & Linux Stack Exchange!


  • Please be sure to answer the question. Provide details and share your research!

But avoid


  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f153737%2fhow-do-i-package-a-django-website-for-debian-not-a-python-package-or-egg%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown






Popular posts from this blog

How to check contact read email or not when send email to Individual?

Displaying single band from multi-band raster using QGIS

How many registers does an x86_64 CPU actually have?