How would I package and sell a Django app?

Currently I am hosting a Django app I developed myself for my clients, but I am now starting to look at selling it to people for them to host themselves.

My question is this: How can I package up and sell a Django app, while protecting its code from pirating or theft? Distributing a bunch of .py files doesn't sound like a good idea as the people I sell it to too could just make copies of them and pass them on.

I think for the purpose of this problem it would be safe to assume that everyone who buys this would be running the same (LAMP) setup.


Asked by: Blake788 | Posted: 24-09-2021






Answer 1

Don't try and obfuscate or encrypt the code - it will never work.

I would suggest selling the Django application "as a service" - either host it for them, or sell them the code and support. Write up a contract that forbids them from redistributing it.

That said, if you were determined to obfuscate the code in some way - you can distribute python applications entirely as .pyc (Python compiled byte-code).. It's how Py2App works.

It will still be re-distributable, but it will be very difficult to edit the files - so you could add some basic licensing stuff, and not have it foiled by a few #s..

As I said, I don't think you'll succeed in anti-piracy via encryption or obfuscation etc.. Depending on your clients, a simple contract, and maybe some really basic checks will go a long much further than some complicated decryption system (And make the experience of using your application better, instead of hopefully not any worse)

Answered by: Kristian104 | Posted: 25-10-2021



Answer 2

You could package the whole thing up as an Amazon Machine Instance (AMI), and then have them run your app on Amazon EC2. The nice thing about this solution is that Amazon will take care of billing for you, and since you're distributing the entire machine image, you can be certain that all your clients are using the same LAMP stack. The AMI is an encrypted machine image that is configured however you want it.

You can have Amazon bill the client with a one-time fee, usage-based fee, or monthly fee.

Of course, this solution requires that your clients host their app at Amazon, and pay the appropriate fees.

Answered by: Elian565 | Posted: 25-10-2021



Answer 3

The way I'd go about it is this:

  1. Encrypt all of the code
  2. Write an installer that contacts the server with the machine's hostname and license file and gets the decryption key, then decrypts the code and compiles it to python bytecode
  3. Add (in the installer) a module that checks the machine's hostname and license file on import and dies if it doesn't match

This way the user only has to contact the server when the hostname changes and on first install, but you get a small layer of security. You could change the hostname to something more complex, but there's really no need -- anyone that wants to pirate this will do so, but a simple mechanism like that will keep honest people honest.

Answered by: John656 | Posted: 25-10-2021



Answer 4

"Encrypting" Python source code (or bytecode, or really bytecode for any language that uses it -- not just Python) is like those little JavaScript things some people put on web pages to try to disable the right-hand mouse button, declaring "now you can't steal my images!"

The workarounds are trivial, and will not stop a determined person.

If you're really serious about selling a piece of Python software, you need to act serious. Pay an attorney to draw up license/contract terms, have people agree to them at the time of purchase, and then just let them have the actual software. This means you'll have to haul people into court if they violate the license/contract terms, but you'd have to do that no matter what (e.g., if somebody breaks your "encryption" and starts distributing your software), and having the actual proper form of legal words already set down on paper, with their signature, will be far better for your business in the long term.

If you're really that paranoid about people "stealing" your software, though, just stick with a hosted model and don't give them access to the server. Plenty of successful businesses are based around that model.

Answered by: Caroline223 | Posted: 25-10-2021



Answer 5

You'll never be able to keep the source code from people who really want it. It's best to come to grips with this fact now, and save yourself the headache later.

Answered by: Jared967 | Posted: 25-10-2021



Answer 6

May I speak frankly, as a friend? Unless your app is Really Amazing, you may not get many buyers. Why waste the time on lawyers, obfuscation, licensing and whatnot? You stand to gain a better reputation by open-sourcing your code...and maintaining it.

Django comes from the open-source end of the spectrum from licensing (and obfuscating). Granted, the MIT license is more common than the GPL; still they are both very far removed from anything like Microsoft's EULA. A lot of Djangophiles will balk at closed source code, simply because that's what Microsoft does.

Also, people will trust your code more, since they will be able to read it and verify that it contains no malicious code. Remember, "obfuscating" means "hiding;" and who will really know exactly what you've hidden?

Granted, there's no easy way to monetize open-sourced code. But you could offer your services or even post a campaign on Pledgie.com, for those who are thankful for all your great work.

Answered by: Melissa708 | Posted: 25-10-2021



Answer 7

One thing you might want to consider is what FogBugz does. Simply include a small binary (perhaps a C program) that is compiled for the target platforms and contains the code to validate the license.

This way you can keep the honest people honest with minimal headache on your part.

Answered by: Maya465 | Posted: 25-10-2021



Similar questions

python - Django Package tests not found

I have a weird problem at hand. I'm creating a django package and would like to provide some test cases for it. The package is named ajax_forms and the full path is part of my PYTHONPATH. This directory also contains a tests directory (with the __init__.py file) a tests.py file (containing the tests) and a urls.py file. Now I want to run the tests. The ajax_forms parent directory ha...


python - Django package naming issues

I have developed a backend library, say, cool_project. Now I want to build a web interface for it. So I create a Django project. Of course, I want to name it cool_project: my mother told me that Hungarian notation is bad and that the name cool_project is much better than any of cool_project_web etc. But now I have a collision. As long as I try importing cool...


python - Django package and app name

I'm working on a small project, that has an app called requests. Now I wanted to use OpenID to identify users but the package has dependencies to the package "requests" and I get an error when trying to run my app. from social.utils import setting_name File "/Users/.../env/lib/python2.7/site-packages/social/utils.py", line 11, in <module> from requests.adapters import HTTPAdapter ImportError: No modu...


python - Django using more than 1 package for admin site

I am using 2 django packages: Admin sortable (For changing the order of models) and Django import export (For importing csv directly into my models). The problem is that if I add the 2 packages into my model admin e.g.


python - Django No Module Named With Inner Package Using

I want to write my own python package inside django's app. It looks like that: I have secondary app. It totally works except one thing. Someday I'd decided to make my app more structured. And there where problems started. First of all, I've added python package(with simple init.py inside directory) to the app. Then I've added second package inside that package. And when I try to run django.setup() inside p...


python package import fails

I've got a trac installation which works correctly from the command line. I deployed the trac.cgi to the proper directory, but when I open the page, I get: Trac detected an internal error: No module named pkg_resources Traceback (most recent call last): File "/some/path/htdocs/trac.cgi", line 22, in ? import pkg_resources ImportError: No module named pkg_resources pkg_resource...


package - What is a Python egg?

I'm new to Python and I'm just trying to understand how its packages work. Presumably eggs are some sort of packaging mechanism, but what would be a quick overview of what role they play and may be some information on why they're useful and how to create them?


macos - using the stats package in scipy error in Python?

I am trying to use the scipy stats package in Python and am getting the following error (on Mac OS X): $ python Python 2.6.5 (r265:79359, Mar 24 2010, 01:32:55) [GCC 4.0.1 (Apple Inc. build 5493)] on darwin Type "help", "copyright", "credits" or "license" for more information. >>> import scipy >>> from scipy import stats I then get the error: Traceback (m...


python - How to send a package to PyPi?

i wrote a little module and i would like to know what are the basic steps to package it in order to send it to pypi: what is the file hierarchy? how should i name files? should i use distutils to create PKG-INFO? where should i include my documentation (made with sphinx)?


Python regex for Java package names

I have problems determining valid Java package names using Python. Here's the code: packageName = "com.domain.lala" # valid, not rejected -> correct #packageName = ".com.domain.lala" # invalid, rejected -> correct #packageName = "com..domain.lala" # invalid, not rejected -> incorrect #packageName = "com.domain.lala." # invalid, not rejected -> incorrect matchObject = re.matc...


python - PyQt4 Need to move DLLs to package root

I've used the new installers from http://www.riverbankcomputing.co.uk/software/pyqt/download for Python 2.6 x86_64 and I've a small problem importing PyQt4 in one particular application. Here's the traceback: # ERROR : Traceback (most recent call last): # File "<Script Block >", line 2, in <module>...


python - Why does "import module" and then "from package import module" load the module again?

I have a package in my PYTHONPATH that looks something like this: package/ __init__.py module.py print 'Loading module' If I'm running Python from the package/ directory (or writing another module in this directory) and type import module it loads module.py and prints out "Loading module" as expected. However, if I then type


Python Local Package Doesn't Load In Call From PHP

So, I want to run a Python program with a home-directory install of PyProj from PHP. The PHP and Python are simple, but I include them below for completeness. I've tested running Python manually using both sys.path.append and PYTHONPATH to specify the location of the package. Both of these methods work. However, when I shell_exec the script from PHP, I'm told Imp...


How can I package python source code?

For example, I have a lots of .py file, which can say it is my own library, install of zip all to share my friends, can I have something like .jar in java to package all the classes in a one single file for sharing? Thanks.


python - Make a package work as just one import

I have a package in my project containing many *.py source files (each consisting of one class in most cases, and named by the class). I would like it so that when this package is imported, all of the files in the package are also imported, so that I do not have to write import Package.SomeClass.SomeClass import Package.SomeOtherClass.SomeOtherClass import ... just to import every class in...


python - How to package Twisted program with py2exe?

I tried to package a Twisted program with py2exe, but once I run the exe file I built, I got a "No module named resource" error. And I found the py2exe said: The following modules appear to be missing ['FCNTL', 'OpenSSL', 'email.Generator', 'email.Iterators', 'email.Utils', 'pkg_resources', 'pywintypes', 'resource', 'win32api', 'win32con', 'win32event', 'win32file', 'win32pipe', 'win32proces...


python - How do I find the modules that are available for import from within a package?

Is there a way of knowing which modules are available to import from inside a package?


python package import fails

I've got a trac installation which works correctly from the command line. I deployed the trac.cgi to the proper directory, but when I open the page, I get: Trac detected an internal error: No module named pkg_resources Traceback (most recent call last): File "/some/path/htdocs/trac.cgi", line 22, in ? import pkg_resources ImportError: No module named pkg_resources pkg_resource...


package - What is a Python egg?

I'm new to Python and I'm just trying to understand how its packages work. Presumably eggs are some sort of packaging mechanism, but what would be a quick overview of what role they play and may be some information on why they're useful and how to create them?


Having a Python package install itself under a different name

I'm developing a package called garlicsim. (Website.) The package is intended for Python 2.X, but I am also offerring Python 3 support on a different fork called garlicsim_py3.(1) So both of these packages live side by side on PyPI, and Python 3 users install garlicsim_py3, and Python 2 users install garlicsim.


macos - using the stats package in scipy error in Python?

I am trying to use the scipy stats package in Python and am getting the following error (on Mac OS X): $ python Python 2.6.5 (r265:79359, Mar 24 2010, 01:32:55) [GCC 4.0.1 (Apple Inc. build 5493)] on darwin Type "help", "copyright", "credits" or "license" for more information. >>> import scipy >>> from scipy import stats I then get the error: Traceback (m...


python - Can i take package of cpython?

I used cpython api to load py from C/C++. But, if i want not setup cpython in client, can I take package dll of cpython in my program? How to do that?


Change package import name in python

I was wondering if it was possible to import a library in python, and completely change its name. say i need to do : import plop.blah.wii but I want it to be recognized as foo.bar.yeah something like import plop.blah.wii as foo.bar.yeah Any idea how can this be done ? When unpickling an object, Python expects a library that I...


I have a series of python modules I would like to put into a package, how can I do this?

I have a series of python modules I would like to put into a package. I would like to set it up such that anyone interested can just download it and install it (on unix). How can I do this?


How to package a python program

Im new to python programming.Im writing a simple command line based twitter app,and i have to use external libraries like simplejson,tweepy etc. Is there a way i can package my python program to include these libraries as well,so that when i distribute this program, the user doesnt have to install the required libraries first himself ? Thank You






Still can't find your answer? Check out these communities...



PySlackers | Full Stack Python | NHS Python | Pythonist Cafe | Hacker Earth | Discord Python



top