Friday, 25 September 2015

Silly mistakes "Task 'saas' is not in your gulpfile" deploying sass with ionic framework

Here is the log of discussion on IRC


satinder
I am deploying ionic on ubuntu machine, i found an error with gulp
$ gulp saas
$ gulp saas
[12:06:36] Using gulpfile ~/myApp/gulpfile.js
[12:06:36] Task 'saas' is not in your gulpfile
[12:06:36] Please check the documentation for proper gulpfile formatting
joeco
yea this is with deploying to ios, like I said, Android is fine and still is working.
junmin has joined
joeco
it's either a problem with ionic, ios or cordova, but if anyone else serious is making interesting apps they know exactly what I'm talking about.
it's super aggravating.
← junmin has quit (Ping timeout: 240 seconds)
joeco
satinder. in your gulpfile, you need some lines that look somewhat like this:
gulp.task('saas', function() {
});
that's assuming you want to run a 'saas' task. (you maybe meant 'sass')
otherwise, just type 'gulp' as your command, and the 'default' task should run
satinder
joeco: yes it is there
gulp.task('default', ['sass']);
gulp.task('sass', function(done) {
gulp.src('./scss/ionic.app.scss')
joeco
that is not defining a new task. It is saying whatever is in the brackets is a dependency of 'default'
satinder
it is already present there
joeco
it means anything in the brackets has to resolve before 'default' is run.
so if you don't want sass, just erase it from the brackets
satinder
right
joeco
or else make a new .task() with 'sass' as the main name / definition
← dan2k3k4 has quit (Ping timeout: 246 seconds)
joeco
oh I see, you have one there
satinder
yes
joeco
maybe it needs to be listed above the 'default'? just a guess
satinder
ok i am trying that way
joeco
are you sure the 'sass' task has something like this as the last line: .on('end', done);
ilmgb has joined
joeco
you have to call the 'done' so that it knows to start the next task
satinder
gulp.task('sass', function(done) {
gulp.src('./scss/ionic.app.scss')
.pipe(sass({
errLogToConsole: true
}))
.pipe(gulp.dest('./www/css/'))
.pipe(minifyCss({
keepSpecialComments: 0
}))
.pipe(rename({ extname: '.min.css' }))
.pipe(gulp.dest('./www/css/'))
.on('end', done);
});
but still not working
qwebirc95493 has joined
joeco
well I don't know. but one other thing you can try, a really handy and simple/straightforward plugin is run-sequence on npm
i use it. you may restructure your order of gulp tasks, the sequence they run in.
maybe going threough that exercise will reveal why the 'sass' task is messed up.
satinder
okay, i will try that ,,,
It's OK, you're connected again :)
[sinisalo.freenode.net]
*** Looking up your hostname...
*** Checking Ident
*** Couldn't look up your hostname
*** Got Ident response
*** Spoofing your IP
← qwebirc95493 has quit (Ping timeout: 246 seconds)
← blackjid has quit (Ping timeout: 240 seconds)
joeco
satinder, I think I know the real solution
can you check your ionic.project file?
under gulpstartuptasks: [] ... you have a misspelling.
← mickhansen has quit (Ping timeout: 240 seconds)
satinder
joeco: Which file
gulpfile.js
?
joeco
it should be in the root of your project
ionic.project
it is the startup file that is called when you do "ionic run android" or whichever
from there it calls gulpfile.js
satinder
yes it is there
{
"name": "myApp",
"app_id": "",
"gulpStartupTasks": [
"sass",
"watch"
],
"watchPatterns": [
"www/**/*",
"!www/lib/**/*"
]
this is the content of ionic.project file
mickhansen has joined
joeco
hmm.. that's strange. the "sass" matches the "sass" in your gulpfile
so I don't know why it said: Task 'saas' is not in your gulpfile
how about in your "watch" task, back in the gulpfile?
does it depend on "saas"?
satinder
no i don't think so
aasp@1313:~/myApp$ gulp watch
[12:33:25] Using gulpfile ~/myApp/gulpfile.js
[12:33:25] Starting 'watch'...
[12:33:25] Finished 'watch' after 11 ms
dan2k3k4 has joined
satinder
Actually i am not using the default sass files of the ionic project
joeco
oh
wait, your original command you typed was "gulp saas"
that's why
what if you type "gulp sass"
satinder
yes it works!
joeco
ha. took the long way to get there :)
marthinal has joined
satinder
yes, thanks joeco
joeco
sure, n/p

Tuesday, 8 September 2015

Adding two repositories to git.

Looking for adding two repo on same git, or say adding another repository other than origin in the same project.

1. Add first repo:

$ git add remote origin master <project repo url>
$ git push -u origin <branch>

2. Adding Second repo

$ git remote add <user> <project repo url>
$ git push <user> <branch>

Tuesday, 30 September 2014

Saturday, 24 May 2014

ImproperlyConfigured: dh5bp doesn't look like a module path (Django/html5)

Add this to your urls.py at the top :

from dh5bp.urls import urlpatterns as dh5bp_urls

apache2: [warn] The Alias directive in /etc/apache2/sites-enabled/httpd at line 47 will probably never match because it overlaps an earlier Alias.

Apache shows this warning because the user may used two Alias for the same path in the Apache configuration files. In my case i used two alias  given as follows:

        Alias /static/ /home/user/site/static/

        <Directory /home/user/site/static>
        Order deny,allow
        Allow from all
        </Directory>

and

         Alias /static/ /home/user/site/static/
         <Location "/static/">
             Options -Indexes
         </Location>

So, i removed the second one.

Friday, 23 May 2014

Deploy Django with apache2 in Virtualenvs

Virtual Hosts


Apache2 has the concept of sites, which are separate configuration files that Apache2 will read. These are available in /etc/apache2/sites-available. By default, there is one site available called 000-default. This is what you will see when you browse to http://localhost or http://127.0.0.1. You can have many different site configurations available, and activate only those that you need.
As an example, we want the default site to be /home/user/public_html/. To do this, we must create a new site and then enable it in Apache2.
To create a new site:
  • Copy the default website as a starting point. sudo cp /etc/apache2/sites-available/000-default.conf /etc/apache2/sites-available/mysite.conf 
  • Edit the new configuration file in a text editor "sudo nano" on the command line or "gksudo gedit", for example: gksudo gedit /etc/apache2/sites-available/mysite.conf
  • Change the DocumentRoot to point to the new location. For example, /home/user/public_html/
  • Change the Directory directive, replace <Directory /var/www/> to <Directory /home/user/public_html/>
  • You can also set separate logs for each site. To do this, change the ErrorLog and CustomLog directives. This is optional, but handy if you have many sites
  • Save the file
Now, we must deactivate the old site, and activate our new one. Ubuntu provides two small utilities that take care of this: a2ensite (apache2enable site) and a2dissite (apache2disable site). 

$ sudo a2dissite 000-default && sudo a2ensite mysite
 
$ sudo /etc/init.d/apache2 restart
 
If you have not created /home/user/public_html/, you will receive an warning message
To test the new site, create a file in /home/user/public_html/

$ echo '<b>Hello! It is working!</b>' > /home/user/public_html/index.html
 
Finally, browse to http://localhost/ 
 
 
 CONFIGURE DJANGO TO APACHE
$ vim /etc/apache2/sites-available/mysite
 
Inside mysite 

        WSGIPythonPath /home/user/site:/home/user/.virtualenvs/test/lib/python2.7/site-packages
        WSGIPythonHome /home/user/.virtualenvs/test
<VirtualHost *:80>

        <Directory /home/user/.virtualenvs/test/lib/python2.7/site-packages>
        Options Indexes
        Order deny,allow
        Allow from all
        </Directory>

      
        WSGIScriptAlias /site /home/user/site/site/wsgi.py
        <Directory /home/user/site/site>
        <Files wsgi.py>
        Order deny,allow
        Allow from all
        </Files>
        </Directory>

        Alias /static/ /home/user/site/static/
        <Location "/static/">
            Options -Indexes
        </Location > 
</VirtualHost>