django-deploy | Deployment tools for django projects | Continuous Deployment library
kandi X-RAY | django-deploy Summary
kandi X-RAY | django-deploy Summary
Management command to automate deployment of django project using distutils/setuptools.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
- Initialize the class .
- Creates a list of Task objects .
- Run tasks .
- Run the function .
django-deploy Key Features
django-deploy Examples and Code Snippets
Community Discussions
Trending Discussions on django-deploy
QUESTION
I have been working on a Django project locally and I finally decided to release it to AWS Elastic Beanstalk and during the deployment process I keep receiving an error saying:
from django.core.wsgi import get_wsgi_application
No module named 'django'
I have walked through the official tutorial from AWS as well as the tutorial from the Real Python I have verified that Django is in fact installed by running pip freeze
and it returns
...
colorama==0.3.9
Django==2.2.9
django-celery==3.3.1
....
Also I've been working with Django extensively locally. But just to be sure I ran the following command and got this output.
(.venv) $ source .venv/bin/activate
(.venv) $ pip install django
Requirement already satisfied: django in ./.venv/lib/python3.7/site-packages (2.2.9)
Requirement already satisfied: sqlparse in ./.venv/lib/python3.7/site-packages (from django) (0.3.0)
Requirement already satisfied: pytz in ./.venv/lib/python3.7/site-packages (from django) (2019.3)
And when I run:
...ANSWER
Answered 2020-Jan-23 at 06:49Well to answer your question, there are few things that you have to check out while deploying your Django or flask or dash application using AWS ElasticBeanstalk(EBS).
NOTE: The following steps are outlined if the application is hosted using AWS EBSCLI i.e the command line feature of EBS and not the method of hosting through the User Interface of the EBS on your AWS account. On my personal experience, I have found that the UI method of hosting the application will not work for flask, Django or dash applications.
- While hosting your application into EBS, check the hosting logs if you have got any errors. Even though the EBS prompts you that you have hosted your application successfully, you will have to cross check on the logs to find any errors.
- Once you have verified you have no errors in Step 1, navigate to the logs console of your EBS application, download entire logs and then check for any other errors. If you have any errors, you have to rectify them first.
- Now that you have said that the AWS Linux machine is not able to import the Django package, it might be that you are checking for the Django package manually under a different virtual environment whereas the AWS EBS has hosted your application under another virtual environment.
- To solve Step 3, it happens to be that any application that is hosted using AWS EBS on a linux server is hosted under the following virtual environment path.
/opt/python/run/venv/bin
. In order to verify this, just type the commandcd /opt/python/run/venv/bin
after connecting to your linux server. Once you're able to navigate to this path, try activating the virtualenv by givingsource ./activate
- Once you've activated this virtualenv that AWS EBS has created for your application, try starting
python
inside this virtualenv and then tryimport django
. If you find that django package is not installed under this virtualenv, you have to install it manually, since this is the virtualenv that your hosted application will refer to. And any new packages that need to be referenced by your hosted application will have to be installed under this virtualenv only. - To further give you additional information, your hosted application will reside on the AWS linux server under this directory
/opt/python/bundle/2/app
. You can refer to this directory if you are willing to alter your application code or any supporting files in the future. For example, if you want to change any of the source code, you can directly edit the source code files under this repository and restart your server for the changes to take effect.
Update: Since you've specified that during the hosting of your application, you have received the error on the django package not found, please follow the following steps to rectify this error.
- While creating your
requirements.txt
file, make sure that only the necessary packages for your application are present inside that file. When you dopip freeze requirements.txt
, all the packages which are present in your current environment will make an entry inrequirements.txt
file. This might create errors while AWS EBS is trying to install this file. The reason is, say for example, PackageA and PackageB might be dependent packages of PackageC. If you install PackageC, automatically PackageA and PackageB would get installed. Having said this, you have to remove PackageA and PackageB in yourrequirements.txt
file and keep only PackageC. Because installation of PackageC would automatically install it's dependent packages which are PackageA and PackageB. So to keep it short, you only have to include the packages that you manually installed usingpip install
in your local machine inside yourrequirements.txt
file. All other packages will be dependent packages of these packages and will install automatically when the master package is installed. So these dependent packages need to be removed fromrequirements.txt
. - If you're still receiving the same error, once the application is hosted with errors, try to connect to your AWS Linux machine using CLI(Command Line Interface), navigate to the virtual environment path by doing
cd /opt/python/run/venv/bin
, activate it usingsource ./activate
, invokepython
interpreter and then try importing the packages manually. If you find any of the packages are uninstalled, you can install them manually and restart the server for the changes to take effect.
For more details, you can refer this link. Though this is created for hosting a flask application, hosting a django application will also work on same lines.
QUESTION
After a bit of a struggle to set up AWS Route53 IPv6 and my DSN (Ionos) I've managed to set up SSL in my Django blog app running with Gunicorn and nginx. I've used this tutorial
Unfortunately, first it ran into the redirect loop error that I managed to fix but now it's 502 Bad Gateway and when I check the logs it looks like Gunicorn workers are alway timing out. I tried setting the timeout to 300s for both nginx and Gunicorn but it just means a longer wait for 502 error, nothing else changes.
Here's the log:
...ANSWER
Answered 2019-Mar-22 at 14:02Turns out the issue was with this line in nginx config:
QUESTION
I followed this tutorial and made a typo where I was supposed to create a user for my django apps to connect as;
I was supposed to run su - postgres -c "createuser www-data -P"
but I ran su - postgres -c "createuser www-dtata -P"
.
I dont want to proceed until I remove that user, which I don't know the command for. I found and tried DROP USER
after searching around, but the terminal returned -su: DROP: command not found
.
ANSWER
Answered 2017-Jul-26 at 11:18Run sudo su - postgres -c "dropuser www-dtata"
QUESTION
I am currently considering the switch from pip / virtualenv to pipenv for my web projects (mainly Django). They use a "minimal downtime deployment" process, inspired by the one described at https://kuttler.eu/en/post/django-deployments-without-downtime/
TL;DR
Is there a pipenv command to create a new environment from scratch (new interpreter, no packages), then install the dependencies, then set it as the default for the current directory ?
Let's take a quick example. I have a project installed on my debian server, with the following structure:
...ANSWER
Answered 2018-Oct-03 at 08:26Instead of using pipenv on the live server, use it only on your development machine and create a requirements.txt
file using the following command:
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install django-deploy
You can use django-deploy like any standard Python library. You will need to make sure that you have a development environment consisting of a Python distribution including header files, a compiler, pip, and git installed. Make sure that your pip, setuptools, and wheel are up to date. When using pip it is generally recommended to install packages in a virtual environment to avoid changes to the system.
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page