can a django application be run using paster? - python

can a django application be run using paster? Or is it pylons specific?

It's pylons specific. There was a Django Paste project, but I'm not sure if it's active or how much progress was ever made.

Related

Django under supervisord?

django project is running under supervisord, when i try to edit the html templates, nothing changes in the web site, should I restart the supervisord or is there other easier way to make changes to the project?

Serverless and NewRelic

I'm using the latest version of the Serverless framework and am trying to integrate NewRelic into my applications. I have both Django as well as Flask applications (-> Python!) which I'd like to monitor with NewRelic. I integrated the framework as documented (by wrapping the WSGI application) and set the NewRelic timeout variables accordingly to make sure data is getting sent.
In my NewRelic dashboard I'm able to see the project but no data is reported. Has anyone had success getting this running?
Thanks!
It might be worth trying the manual instrumentation in your main app file instead of the wsgi file to see if thats working.
import newrelic.agent
newrelic.agent.initialize('/some/path/newrelic.ini')
... YOUR_OTHER_IMPORTS
https://docs.newrelic.com/docs/agents/python-agent/installation-configuration/python-agent-integration#manual-integration
If that works, work backwards towards the wsgi file :) (be sure to restart your app)

Usage of Heroku with Django

I'm currently learning Django and getting a decent grasp of it. I know you can start the server with python manage.py runserver. But then there is also heroku ps:scale web=1 followed by heroku open to open the web page at the subdomain you chose on the host herokuapp.com. What is the point of using heroku vs just runserver? When it comes time to deploy to production is that what heroku is used for as I read it was for deployment? What is exactly is heroku used for and what are the reasons? When creating a professional django web site/application is heroku required or just very useful? If so why? I don't really understand the reason for using heroku. And I'm curious what the best practices are for django and whether they include using or not using heroku.
Aside from the heroku question, what are the best practices for django as far as setting a domain name and such (other than the herokuapp.com subdomain name) and also as far as what other components/software solutions are worth using with django?
One of the things I'm working on is an FTP portal on the website that people can login to and upload files. Does django have plugins/python modules for such a thing or must it be done custom? Which brings me to my final question, What kind of addons/modules does django offer to avoid reinventing the wheel when implementing a django website/app's certain features?
The tutorial I'm following: http://tutorial.djangogirls.org/en/django_orm/README.html
has helped me get a grasp on django, but I'm curious about the more advanced parts of it. Such as custom modules, custom styling, custom scripts (whether they are js or strictly python).
If someone could point me in the right direction or offer any suggestions it would be much appreciated. The tutorial has me using the modules: dj-database-url, whitenoise, gunicorn, python-dateutil, psycopg2 , requests. I know what some of them do, but what is the purpose of psycopg2, whitenoise, dateutil, and dj-database,url? Are there any other modules worth using?
Sorry for the wall of questions, but I'm trying to understand django as best I can so that I can do a correct assessment when putting together a django project.
Thanks in advance.
EDIT, final questions:
1) Also when i used heroku they gave me a subdomain at herokuapps.com Can I set my own URL and still use heroku?
2) And last but not least, heroku makes you register and gives you a subdomain on herokuapp.com Is there a way to use heroku with your own domain rather than the one they give you? Is there a specific way to do it?
EDIT 2:
When I do runserver it works fine, but when i run it with heroku ps:scale web=1 and then heroku open it opens but only shows the title at the top of the page, and no content. Not sure exactly why that is. Can someone explain the difference between runserver and heroku ps:scale web=1 followed by heroku open??
python manage.py runserver is only for development. Never use it in production.
Heroku makes it super easy to deploy your Django code. You only need some configs and git push heroku master. But it's not the only way to deploy your code. You can also set up a server with a webserver like Nginx, Gunicorn as WSGI server, and a database of your choice. To set things up, you need to know something about Linux and the command line.
So if you don't know how to set up a server, Heroku can be very useful.
Heroku supports custom domains, and it's easy to set up.
As Mikeec3 mentioned, "Two Scoops of Django" is a very good read.
If you are looking for django packages, www.djangopackages.com is a good place to start.
psycopg2 is for postgresql usage with your app. White noise allows you to serve your staticfiles without nginx if using gunicorn. Requests is an easy to use urllib2 library with pythonic calls to work with apis from other websites.
If you want to do some testing with say facebook logins Heroku is a great place to go to, especially if you need a url outside of localhost.
My suggestion is you read Two scoops of Django http://twoscoopspress.org/products/two-scoops-of-django-1-6
It goes over alot of best practices and serves as a great tutorial after polls. I suggest also incorporating django-bower into your project. Ill list a few great things to add.
Django Bower: https://github.com/nvbn/django-bower - Helps organize static files
Crispy Forms : https://github.com/maraujop/django-crispy-forms - Great form rendering, great with bootstrap
Django Rest Framework: https://github.com/tomchristie/django-rest-framework - REST APIs
These are just to start, there's alot to learn.

Packaging or compiling django application

I have been developing a django application, and now i want to give to someone for testing but i want to keep the sourcecode hidden/compiled so they can't modify it, is there a way to package a django application and still use Apache for serving it? Or any other solution for packaging a django application.
Thanks

Saving Changes To Django with Nginx?

Anything I modify on my Django app has no effect with what's live on the webapp itself. I can delete the entire project directory and my Django app still works.
With Django and Apache, I would simply enter:
/etc/init.d/apache2 restart
And any changes made to my Django application would go live immediately after Apache was restarted. But with this new Nginx, the same thing doesn't work:
/etc/init.d/nginx restart
My Django home page still shows the:
It worked!
Congratulations on your first Django-powered page.
How do I make my Python changes go live with Django and nginx?
What is your Nginx configuration? What is your WSGI runner, are you using Nginx-wsgi or the inbuilt Django 'runserver' command?
It sounds like the "it worked" page is on a separate port, and you're testing it directly -- not via Nginx. It's really easy to get the two of them confused :)
Nvm just figured it out. For Django One Click Install Image on Digital Ocean you need to run:
service gunicorn restart
After you've made all the changes and you'd like to test changes to your web app.

Categories

Resources