Running python executable on a target machine - python-2.7

Is it possible to run my python executable on target machine without the dll's?
I have used pyinstaller and it runs perfectly fine on a target machine but the problem with using pyinstaller is the size of the folder that it creates. My script uses the selenium webdriver.
Is it possible to create an extension and run it from the browser itself without the client having to download it?
if its possible then i need some hint

Related

how to run Django locally as a windows executable app

I'm considering building app with Django for only one user that would run application locally on windows. I read about containerizing Django apps, but it's new for me.
My goal is to run Django server on one click like a standard windows app and connect to it on localhost and interact with web browser. It is even possible?
It is possible, but this may not be the best solution. If you want to release a Django app that can be installed on your client computer, you usually need to ensure all the dependencies are shipped with the app.
Containerising your application means it will depends on Docker runtime (or any container system you use). You will have to setup Docker with your app, or ensure your client has Docker on his machine to run it. If the destination machine runs Windows or macOS, you will need to setup docker-desktop which may be more complicated than standard Docker runtime (linux only).
But if you decide to ship your app without containerising it, it will only depends on a Python interpreter and some dependencies (Django, dateutil, etc.). In such case, using python tools like virtualenv, you may prepare a ready-to-run application by creating the venv and installing dependencies at "build time". Then, with a proper setup (MSI for Windows or DMG for macOS), you may be able to distribute the final application so the client can install and run it without any additional step (you do all the hard job yourself).
Django app can be convert into .exe but it wont work as local server while click .exe because runserver command and some of django service wont support on this way as per my experiment.

AWS Lambda - NodeJS based function that requires Linux dependency packages

Trying to create a function which is based on NodeJS that runs a C++ compiled code. The C++ code required me to install certain Linux packages using 'yum' in order to run.
The NodeJS and the C++ parts work great when running on Docker, because in the DockerFile I can install all the needed Linux dependencies that the C++ code requires using 'yum' command before the app execution.
When running under a Lambda I do not know how to tell the running container to install these Linux packages in order the C++ to run and be loaded successfully by the NodeJS.
I am trying to create a NodeJS Runtime based function with all my code and add a Custom Runtime layer before the function loads that can install all the dependencies to the OS (Not NodeJS dependencies - Linux OS dependencies).
I tried creating a custom runtime function but didn't understand how to connect everything and how it should (if possible) connect to the function itself even after configuring the layer version to the function.
Does anyone know how such a thing can be achieved?

Using Windows to run a virtual environment Created on Ubuntu

so i have been developing a website with a backend database. The following is my current setup and it is working great:
Currently using Ubuntu 16.04
I created a virtualenv and downloaded Django and postgreSQL within the virtual environment.
I also downloaded and am using Python 3.5.2 within the virtual environment.
My entire folder structure is on GitHub so that I can edit the code on the go (Again, everything working fine on Ubuntu).
The problem comes when I want to start doing some editing on Windows 10 using Powershell. I am unsure of how to run the 'activate.sh', 'activate.csh', or 'activate.fish' file in order to run the virtual environment and initialize my server using 'python manage.py runserver' so I can start editing my website.
Has anyone run into the problem and found out how to fix this? Any help on how to get started working on Windows would be great.
If you need any more details id be glad to provide them.
Thanks!
Assuming that you have created a virtualenv on ubuntu without relocatable option. You will have to firstly create a new virtual environment on Windows because they have differences on OS variations. So navigate to the directory where you would like to create the new virtual environment on Windows and run the following command:-
virtualenv .
(Note the . specifies current directory option)
After this there will be three directories created in your directory namely
1) Include
2) Lib
3) Scripts
As now the activate.bat file is in Scripts you can activate your virtualenv by the following command:
Scripts\activate
After the environment is activated you can pip install -r requirements.txt and then run your manage.py script as usual.
For further reference you can read:-
https://virtualenv.pypa.io/en/stable/userguide/

Django on production server (No module named urls)

I'm setting Django on production server and have this strange error(on picture below)
As you can see pythonpath seems to be ok(first row is my project folder), I definitely have module urls.py inside my project/project folder, I have init file there and my ROOT_URLCONF = 'project.urls'(I also tried without project name, but it didn't help either).
So, that is strange why it can't find it :(
I have to say that I tried to create a new project on server and then it seems to be ok, but with this project that is copied from local server it is behaving like this.
Printscreen of error:
The only problem I can think of is the process of package creation. What process have you followed to deploy your Django application?
If you have compiled the Django application on your local machine or CI server and then deployed the compiled package then you will run into Import module issues because pyc files will contain hard coded paths of your local machine or CI servers. To fix it before compiling the python files you should create the same hierarchy on your local/CI server and then compile and deploy.
Hope this helps.
[Edit]
I agree hardcoded paths in pyc files is PITA and we have been doing this in our production environment once we discovered it.
However I do not agree with you to re generate pyc files on the server because as your application will grow and you move towards a large application it will become very slow.
You don't have to keep your development environment directory to follow production directory structure. Instead you can have any directory path on development machine and create a separate bash script which will create a package for you by creating a directory structure that you follow on production. Bash script will have the logic of
Creating a directory structure similar to production
Checking out the code from source control
Compile the code using python -m compileall .
Create a tarball
You can untar this tarball on production server and your application should run fine.
For more information about package creation in python and best practices, check out this video
It doesn't look like your project is in your path, actually. The traceback is only showing Django packages.

Problems running remote C++ program in Netbeans

Here is the scenario.
I have a C++ application using CMake that has been setup on Ubuntu server machine. I have setup a remote development interface to it using Netbeans 6.9 on client machine, and I have been able to build it.
The problem is that (as per the setup of CMake script) the executables from the program are going to another directory in the server. When I try to run the program, Netbeans asks me for executables which I can't spot out on client machine (as they are residing on server machine).
Is there a way I can get the executables on local machine OR have a way to give their location to my Netbeans application.
Thanks for your help.