This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os, sys | |
import django.core.handlers.wsgi | |
sys.path.append('/var/www/html/PROJECT') | |
os.environ['DJANGO_SETTINGS_MODULE'] = 'PROJECT.settings' | |
application = django.core.handlers.wsgi.WSGIHandler() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
uwsgi --socket 127.0.0.1:8000 --master --workers 1 --harakiri 30 --daemonize /tmp/daemonize.log --pidfile /tmp/uwsgi.pid --vacuum --max-requests 100 --gid 500 --uid 500 --pythonpath /var/www/html/PROJECT --module UWSGI |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
user nginx; | |
worker_processes 1; | |
error_log /var/log/nginx/error.log; | |
pid /var/run/nginx.pid; | |
events { | |
worker_connections 1024; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
google.maps.event.addListener(marker, 'click', | |
(function(marker_inner) { | |
return function() { | |
new google.maps.InfoWindow({ | |
content: 'Marker : ' + marker_inner.data.title | |
}).open(map,marker_inner); | |
map.setCenter(marker_inner.getPosition()); | |
} | |
})(marker) | |
); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def array_chunk(arr, size): | |
chunks=[arr[x:x+size] for x in xrange(0, len(arr), size)] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions | |
{ | |
... | |
self.tabBarController = [[UITabBarController alloc] init]; | |
UIViewController *homeViewController = [[HomeViewController alloc] init]; | |
UINavigationController *homeNavigationController = [[UINavigationController alloc] initWithRootViewController:homeViewController]; | |
self.tabBarController.viewControllers =[NSArray arrayWithObjects:homeNavigationController, nil]; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ARCHFLAGS=-Wno-error=unused-command-line-argument-hard-error-in-future easy_install |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# view.py | |
def upload(request): | |
if 'file' in request.FILES: | |
upload_location = ModelName.upload_file(request.FILES.get('file')) | |
if upload_location: | |
print upload_location | |
else: | |
print 'oops, file upload failed!' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# decorators.py | |
def parameters_missing(request): | |
response_data = {} | |
response_data['status'] = False | |
response_data['message'] = 'Missing parameter' | |
return HttpResponse(json.dumps(response_data), content_type="application/json") | |
def open_request(request): | |
@csrf_exempt |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pip install django-toolbelt | |
nano Procfile | |
foreman | |
foreman start | |
pip freeze > requirements.txt | |
sudo pip install dj_database_url | |
heroku create | |
git init | |
git add -A | |
git commit -m '' |
OlderNewer