How to change the default django project directory in linode - django

I want to deploy a django application using linode. In the /var/www directory in my linode server, there is a default django application named, DjangoApp. I dont want to use this default application to deploy my app so I have cloned my django project into the same directory but linode only listens to the default project. Please how do i make linode listen to my new project instead?

Related

How to run Django new project in the same VS code folder which already has a project that is running on every runserver Port?

I created two projects baseproject and web_project using django in vs code folder: smcode5 with virtual environment.
I used web_project first to create an app and run on server port 8000.
Now I want to use baseproject for an app, but only web_project runs.
Any suggestions?

Using a local Django app without packaging it

I'm planning to write an add-on app for an existing django app. The primary app is running smoothly via docker-compose, and I've remoted into the container via the vscode remote-containers extension.
Add-ons are installed like most any other django app, pip install APPNAME, append to INSTALLED_APPS, migrate, collectstatic, restart server.
I can create a directory anywhere in the container, where the add-on will exist and be developed, but I'm looking for a way to make the app visible from that directory so I can include it in the primary app's INSTALLED_APPS list. Is this possible, or would I have to create the app inside the primary package's site-packages directory alongside its own sub-apps for this to work?

React and Django deployment

I developed an app and I want to deploy it on a server. For backend I use Django and for frontend React. The communication between React and Django is via rest api. I also have an Arduino which communicates with Django via rest. I use nginx on server. What is the best way how to deploy this app? Thanks a lot
Well you need a server, popular choices to rent one are AWS or Heroku. Both have a free limited trial and tutorials that explain to you how to deploy your project. Heroku should be a easier to use, while AWS provides more features. Links:
-AWS Elastic Beanstalk: https://aws.amazon.com/it/elasticbeanstalk/
-Heroku: https://www.heroku.com
There are lots of available alternatives of build and orchestration tools.
For example Ansible has many modules for django, nginx, npm, databases... that allow to perform any actions and commands whatever you want. Just configure some webhooks in your repository settings so you could trigger autodeploy by pushing new changes or run it manually if needed.
What i did was use my VPS to host the Django app, and then used graphql (similar to REST) to communicate from React to Django.
The general steps are:
1) on the VPS server, you will have a code directory w/ your Django app, like on your local machine. Just use git to get it there.
2) create a virtualenv on the VPS server with all your needed django/python modules (added via pip) in your code directory
3) create an nginx conf file. i use nginx to proxy_pass to apache, which calls the python app. my nginx listens on port 80, and has a line this this: proxy_pass http://admin.mysite.com:81;. Create a link to this config in /etc/nginx/sites-enabled/ and restart nginx.
4) create an apache conf file with <VirtualHost *:81> with key lines such as: WSGIDaemonProcess and WSGIScriptAlias which point to your virtual env and your wsgi.py file. make sure to enable this too ('a2ensite`).
5) your project's wsgi.py file will point to your app's settings.
6) restart apache and nginx.
That's the real rough outline, and there are tutorials written. Just search for 'django uwsgi nginx' and that will get your django app running, with the proper endpoints for your react app to call.
you can use 1 server with nginx and gunicorn and make the axios to point to localhost for the react app, create 1 gunicorn for the django and 2 nginx 1 for the django and the other for the react,
Gunicorn use the socket and service file you can use the below link (it will help you for the deployment of django):
https://www.digitalocean.com/community/tutorials/how-to-set-up-django-with-postgres-nginx-and-gunicorn-on-ubuntu-18-04
for the react app it is easier, you can make the build on your local and clone the project on the server (make the app to point to localhost)
just create nginx file with the belw:
server {
server_name yourdomain.com;
root /project-path/;
index index.html index.htm;
location / {
try_files $uri /index.html =404;
}
}

What are the localhost URLs for OpenShift hosted Django apps

I created a Django application locally and then using the django openshift template from
here I uploaded it to OpenShift successfully. Now I'm trying to work on the local repository for adding additional features but when I run the server locally, I get a bad url error.
What I would like to know is how do I locally host a OpenShift Django App?
I also tried rhc tail -a appname but that only gets me a small amount of debug info If I can't locally host it then is there a way with which I can see the python print() output for the app hosted on OpenShift?

django project daesn't work on subdomain

I'm new in python and django.
I have virtual hosting account on bluehost.com. I have main site in public_html folder (cms - wordpress). Now I want make django project on subdomain. I found hoster's instruction and setup python 2.7 on my hosting. I installed django 1.6 too (by official manual). Both works correctly (I checked it by ssh-consol)
With django-admin.py I've created app. Also I've created subdomain and directed it to the same folder.
Now I have structure:
/user - my account folder<br>
/user/python - python folder<br>
/user/django - django folder<br>
/user/public_html - main site folder<br>
/user/public_html/dev - project and subdomain folder
I'm in stalemate, because project doesn't work. When I go on dev.main_site.org, I see just hoster's html default page. But, if I right understood instruction I should see demo project (sign-in page). How to correct it?
Thank you!
There are many steps to be gone through, to host your app. You have to setup an app server, like gunicorn, and connect it to the main server, say apache..
May be this should help...