How to allow installing and install Django applications?

Follow

Comments

21 comments

  • Avatar
    Plesk

    Can you please clarify step 10? what is the directory structure before and after this command?

    0
    Comment actions Permalink
  • Avatar
    Bulat Tsydenov

    Thank you for bringing that to our attention. The article was modified.

    0
    Comment actions Permalink
  • Avatar
    Ariel

     Hi thanks for the tutorial, I tried to follow the steps however i seem to have issues with the Phusion Passenger. I tried through both nginx proxy and apache however in the first i get a forbidden 403 error and in the second to a generic centOS testing html page. it seems that when i got to my example.com site the django server is not reached.

    0
    Comment actions Permalink
  • Avatar
    Konstantin Annikov

    @Ariel

    I could not find any staff with similar symptoms in the internal knowledgebase. 

    So, I recommend you to contact our Technical Support in order to find the cause of the issue. 

    0
    Comment actions Permalink
  • Avatar
    Phoebe Bright

    I have followed these instructions on a Centos 7 server with Plesk Onyx installed.

    When I try to add these lines to additional apache directives (my setup is slightly different)

    PassengerPython /home/.virtualenvs/myapp/bin/python
    PassengerEnabled on

    I get the error:

    Invalid Apache configuration: [Wed Nov 22 11:18:45.584621 2017] [so:warn] [pid 19397] AH01574: module actions_module is already loaded, skipping [Wed Nov 22 11:18:45.587626 2017] [so:warn] [pid 19397] AH01574: module headers_module is already loaded, skipping [Wed Nov 22 11:18:45.588008 2017] [so:warn] [pid 19397] AH01574: module logio_module is already loaded, skipping [Wed Nov 22 11:18:45.589475 2017] [so:warn] [pid 19397] AH01574: module suexec_module is already loaded, skipping AH00526: Syntax error on line 3 of /var/www/vhosts/system/admin.myapp.com/conf/vhost.conf: Invalid command 'PassengerPython', perhaps misspelled or defined by a module not included in the server configuration

    By default, Phusion Passenger was not installed, but I added it by going to 

    • Plesk, Tools & Settings, Plesk - Updates and Upgrades, Add/Remove components, Web Hosting, click on Phusion Passenger server, Continue

    and now shows as installed.

    On another server with Ubuntu rather than Centos and the same version of Plesk I was able to use this line in the apache directives successfully but am a bit wary of installing things outside of plesk:

           WSGIScriptAlias / /home/django/myapp/config/wsgi.py

    Are there any alternative approaches to getting this working?  

     

     

    0
    Comment actions Permalink
  • Avatar
    Artyom Baranov

    @Phoebe Bright,

    Hello! We have an article for the first "module is already loaded" issue: https://support.plesk.com/hc/en-us/articles/213944985

    As for the second question, could you please clarify the purpose of this directive?

    0
    Comment actions Permalink
  • Avatar
    Dmytro Gierman

    Hello, @Artyom Baranov, @Alexandr Bashurov 

    I think instead of `passenger` your developers could use `gunicorn` which is kind`a standard for Django hosting and it is much simpler, too.

    Could you point me a link to a forum, where new features are discussed ?

     

    0
    Comment actions Permalink
  • Avatar
    Ivan Postnikov

    Hi @Dmytro!

    You may propose a new feature at Plesk user-voice. Each feature may be discussed, there is a functionality to comment there.

    Suggested features are monitored by Plesk Development Team and popular suggestions are likely to be implemented.

    0
    Comment actions Permalink
  • Avatar
    Alejandro Betancor

    Hello friends,

     

    I'm using CentOS 7 and Plesk Onyx last patch.

    when I log in as the hosting(customer) user and execute:

     

    python3.6 -m virtualenv -p python36 python-app-venv

     

    I get the following error message:

     

    Could not find platform independent libraries <prefix>
    Could not find platform dependent libraries <exec_prefix>
    Consider setting $PYTHONHOME to <prefix>[:<exec_prefix>]
    Fatal Python error: Py_Initialize: Unable to get the locale encoding
    ModuleNotFoundError: No module named 'encodings'

    Current thread 0x00007f5438eef740 (most recent call first):
    Aborted

     

    Which may be the cause?

    thanks and all the best

    0
    Comment actions Permalink
  • Avatar
    Alexandr Bashurov

    @Alejandro Betancor,
    As I understand, you were trying to deploy the virtualenv environment using the Python installed into the chrooted shell template.

    It might not be possible to properly add Python to the chroot due to the dependencies on the native and shared modules it has. The lack of these modules in the chroot causes such error to appear.

    Please, change the shell for the system user to /bin/bash (not chrooted) in Domains > example.com > Web Hosting Access, as suggested in the article and prepare the environment using it.

    0
    Comment actions Permalink
  • Avatar
    Alejandro Betancor

    @Alexandr Bashurov

    I'm using /bin/bash and have the same problem.

     

    I can not find the solution for this...

    0
    Comment actions Permalink
  • Avatar
    Cbordon (Edited )

    I was able to get my Django site up and running except for one thing.

    I can not serve my media files. (My static files work fine)

     

    How would I go about serving my media files with this configuration?

    I tried following other guides online for serving media files on nginx.

    This for example:

    server {
    	server_name project.domain.com;
     
    	location / {
    		root /usr/local/nginx/html/project.domain.com/public/;
    		passenger_enabled on;
    	}
     
    	location /media {
    		alias /usr/local/nginx/html/django/contrib/admin/media;
    	}
    }

    But they did not work.

    Thanks in advance.

    0
    Comment actions Permalink
  • Avatar
    Alisa Kasyanova

    @Alejandro Betancor
    Make sure that you have only one installed version of python on the server, otherwise, they may conflict with each other.

    0
    Comment actions Permalink
  • Avatar
    Alisa Kasyanova

    @Cbordon
    Is "Serve static files directly by nginx" enabled in Domains > example.com > Apache & Nginx Settings?

    0
    Comment actions Permalink
  • Avatar
    Alejandro Betancor

    Hi @Alisa Kasyanova

     

    which are the best practices to remove python 2.7 from CentOS 7 without breaking the system(Plesk) ?

     

    thanks

    0
    Comment actions Permalink
  • Avatar
    Nikita Nikushkin

    Hi @Alejandro Betancor,

    It is not recommended to remove Python

    Removing python without dependencies will break yum

    Usual python removing with dependencies will fail with the following error:

    Error: Trying to remove "yum", which is protected
    0
    Comment actions Permalink
  • Avatar
    Alejandro Betancor

    Hello @Nikita Nikushkin

     

    Then how can I afford to have only one version of python installed? CentOS comes by default with Python 2.7 and in this guide they are explaining how to install Python 3.6.

    How can I acomplish to follow the advice of @Alisa Kasyanova, if I can not uninstall version 2.7?

     

    There is a solution ?

     

    All the best

    0
    Comment actions Permalink
  • Avatar
    Nikita Nikushkin (Edited )

    @Alejandro Betancor,

    She did not mean removing the Python 2.7 as is

    There is a possibility that you have several Python 3.X versions installed from different repositories. In this case, yes, there is a probability that they can conflict with each other

    I double checked the solution from the article but did not receive errors as yours

    Please repeat all steps from the beginning and if the issue still persists create a request to Plesk Support Department to give us an opportunity to take a look at the issue

    0
    Comment actions Permalink
  • Avatar
    Alejandro Betancor

    Hi @ Nikita Nikushin,

     

    Thanks for your answer,

    Regarding this "She did not mean removing the Python 2.7 as it" it is quite confusing when the answer was "Make sure that you have only one installed version of python on the server, otherwise, they may conflict with each other." the only way to "have only one version of python on the server" would be removing the other ones. Or maybe it needs a little bit of explanation how to have only one version when having 2.7 and 3.6 because is well known CentOS 7 comes with 2.7 by default and in this guide we are installing 3.6.

     

    I went all the steps of the guide again with my CentOS 7 and so far I have the same problem.

    I will proceed to create the ticket.

     

    all the best

    0
    Comment actions Permalink
  • Avatar
    Alisa Kasyanova

    @Alejandro Betancor
    I see that you have created a ticket with us. Let's proceed with the discussion there in order to avoid any further misunderstanding.

    0
    Comment actions Permalink
  • Avatar
    Alejandro Betancor

    Hi @Alisa Kasyanova

    Thanks for the quick reply, really looking forward to get Django working :)

     

    All the best

    0
    Comment actions Permalink

Please sign in to leave a comment.

Have more questions? Submit a request